I am debuggin a subtle bug that is thrown from a .net custom component (no source and obfuscated). The component throws a NullReferenceException in its OnPaint() method which makes calls to subscribers, including my code. I am 100% sure that the problem is in my code. The problem is that visual studio debugger does not stop at the point where the exception is thrown, as it should (I enabled NullReferenceException in the Debug/Exceptions dialog).
This is the first time I encountered such a problem in visual studio. Any ideas on identifying offending code, please?
Kemal
Likely the problem is your code isn’t throwing the
NullReferenceException, however it is probably returningnullat some point. You could try adding guard conditions at the end of your functions that ensure you are not returningnull, such as anDebug.Assert(retVal != null, "Returned null in function").If you are sure you own code is throwing a
NullReferenceException, make sure you turn on thrown exceptions, rather than user-unhandled ones.