Not sure why. But are you sure the running application is compiled using the code you are stepping through. I have seen this sort of thing when the code is different to what is actually being executed.
Is your program multi threaded?
I have seen situations where I check a value and then try using it only to find its changed. Whats happened is that another thread as changed the value after I checked it but before I used it.
Are you certain that you're actually on the line you have highlighted? You can click around in the call stack window and make any part of the call stack the "current" line in the sense that you can get the value of variables there and so forth.
The point being, perhaps EndedUsingApplication sets ActiveApplication to null, so that ActiveApplication wasn't null when it evaluated the if, but now it's null when you're evaluating it in the debugger.
Have you put a breakpoint on the EndedUsingApplication(ActiveApplication) line to make sure ActiveApplication is null before you execute that line?
I think a better approach is to use Object.ReferenceEquals as it is more explicit:
public static bool operator ==(ActiveApplication a, ActiveApplication b)
{
// same reference so equals is true - will be true for null == null
if (object.ReferenceEquals(a, b))
return true;
// one is null and the other is not
if (object.ReferenceEquals(a, null) || object.ReferenceEquals(b, null))
return false;
// dealt with all combinations of null - compare fields
return a.process_name == b.process_name && a.window_title == b.window_title;
}
public static bool operator !=(ActiveApplication a, ActiveApplication b)
{
return !(a == b);
}