❔ I'm confused how "x = false" can cause a NullReferenceException
declaration of _isUpdatingPeakValue is inside a public sealed class:
The code is in a large, decompiled (open source) library, and is called by a timer (setup automatically by the library).
I can give more details if needed, but thought I'd ask with the basics in case I was missing something obvious first. It consistently crashes at this spot when run with debugger (but not when it's not). .Net 4.8
7 Replies
I'd guess
this
is nullyah, i think so, but it's odd that it's there and never the previous _isUpdatingPeakValue = true
i guess i don't know what's happening in the function calls in between
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.Is this a release build?
If it is, I wouldn't necessarily expect the line number to be correct there -- it might be actually be raised on one of the lines above
It should be impossible for
this
to be null there, unless that method is being called by reverse p/invoke or IL manually emitted at runtime or something. The compiler always emits IL which ensures that this
is not null (unless it's certain that it cannot be null)Use the debugger to check if this is null
If the library is decompiled, then the debugger may point to the wrong line. Stacktrace will give much more information in this case
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.