I have the following situation. In a method I have the following code:
XmlNodeList n_vulnerablesystemslist = n_alertdocument.SelectNodes(
"./x:VulnerableSystems/x:VulnerableSystem", nsmgr);
foreach (XmlNode n_vulnerablesystem in n_vulnerablesystemslist)
{
DataModel.Vulnerability.VulnerableSystem currentVulnerableSystem =
new DataModel.Vulnerability.VulnerableSystem();
currentVulnerableSystem.Title =
n_vulnerablesystem.SelectSingleNode("./x:Title", nsmgr) == null
? ""
: n_vulnerablesystem.SelectSingleNode("./x:Title", nsmgr).InnerText;
currentDeepSightVuln.VulnerabilityVulnerableSystems.Add(
currentVulnerableSystem);
}
Where VulnerabilityVulnerableSystems is the following collection definied inside the Vuln currentDeepSightVuln object:
public virtual List<VulnerableSystem> VulnerabilityVulnerableSystems
{ get; set; }
The problem is that when try to execute the Add operation the following exception is thrown:
- ex {"Object reference not set to an instance of an object."} System.Exception {System.NullReferenceException}
This seems to me very strange because, in the debugger I can see that the VulnerableSystem currentVulnerableSystem object is initialized and that its Title is correctly valorized.
So what is the problem? What am I missing? How can I solve it?
Tnx