Following code
if (_LastMouseClickArea != null)
{
if (_LastMouseClickArea.GridItem == GridItem.DataCell)
{...
fails because _LastMouseClickArea is null. I know it sounds silly, so I came here.
From Immediate Window:
_LastMouseClickArea != null
true
_LastMouseClickArea
null
_LastMouseClickArea == null
false
_LastMouseClickArea.GetType()
'((object)(this._LastMouseClickArea))' is null
What could cause this behavior?
Resolution: Before submitting, I remembered to do some Rubber duck debugging. That led me to check how
==is implemented, and, sure enough, there was some strange P/Invoke call for whichnull != nullequalstrue.So here it is, for future reference, if anyone encounters the same issue.