Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Null Reference Exception in BorderlessWindowBehavior.TopMostChangeNotifierOnValueChanged #2674
What steps will reproduce this issue?
I got a Null Reference exception when trying to open my Metro app that contains several metro windows. I really don't have a particular way to re-create this as I typically don't have this error. I'm guessing this is dependent on the execution order of the underlying threads somehow. The fix looks simple I guess, but I'm not sure how to create a test for it (assuming that's required). Here's my stack trace.
System.NullReferenceException: Object reference not set to an instance of an object.
Um, it doesn't crash?
Suggested Code Change
Here's the existing code. The only thing that could be null is the AssociatedObject.
So, I think the obvious change should be this, but beyond that, I'm not sure what should happen.
Yes, TopMost is being called in these event handlers for the Metro Window. Perhaps this not the best practice for ensuring that the window is on top?
From: Jan Karger [mailto:email@example.com]
@mikeasage https://github.com/mikeasage That's in my eyes little bi strange and I want to figure out why this can happen. So I see in your stack trace (thx for this) that the TopMost property is changed. Maybe one of your windows do this? Thx.