Why NullReferenceException warning inside try...catch?
In the code snippet in the attached file, nothing I tried would remove the NullReferenceException warning on vehicle.SelectSingleNode("f[@n='DLRStockID']").
I would think rapping the block in a try...catch would have been sufficient to remove that warning.
What am I missing?
Thanks,
David Holt
Attachment(s):
NullReferenceException.cs.zip
Please sign in to leave a comment.
The try/catch handles the exception, but does not prevent it. To prevent it, check the return value of vehicle.SelectSingleNode("f[@n='DLRStockID']") for null.