You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Window.TitleBar can be null in Window.set_DisplayState #641
The getter for Window.TitleBar (Window.cs:397-400) returns a new instance each time it is called: public virtual TitleBar TitleBar { get { return factory.GetTitleBar(this); } }
This means that the following code in Window.set_DisplayState (Window.cs:336-338): if (AlreadyInAskedState(value) || TitleBar == null) return; TitleBar.SetDisplayState(value);
uses two different instances of TitleBar, including a possible null reference (from PrimaryUIItemFactory.GetTitleBar).
Because Window.get_TitleBar returns a new instance on each call, both references to Window.TitleBar in Window.set_DisplayState should use the same local variable.
It may also be worth hiding the property TitleBar behind a method that declares the return of each call as a new, possibly null, object.
Activity