Hey
I have run into a rather weird little problem.
In the following code I can not understand how e
can be null
;
try
{
//Some Code here
}
catch (Exception e)
{
//Here e is null
}
As far as I know, throw null
will be converted to throw new NullReferenceException()
.
The problem seems to be related to multithreading, as removing another thread also seems to fix it. Or at least I have only seen this when the above code is run in a new thread. The whole program uses many threads and is a bit complex.
Anyway my question is, how can e
be null? - Hopefully the answer to that can help find the source of this problem.
Edit I discovered it since it caused a NullReferenceException in the catch statement, and using the debugger I see the same thing.
Edit 2 Open VisualStudio the next day tried again, no code changes and now the same catch phrase is "called" but this time e is not null. It appears it was a VS glitch.