So I have a control which, in response to its items being changed, calls UpdateLayout(). This results in a stack trace that looks like the following:
Description: The application requested process termination through
System.Environment.FailFast(string message). Message: Unrecoverable
system error. Stack: at System.Environment.FailFast(System.String)
at MS.Internal.Invariant.FailFast(System.String, System.String) at
MS.Internal.Invariant.Assert(Boolean, System.String) at
System.Windows.Window.GetWindowMinMax() at
System.Windows.Window.MeasureOverride(System.Windows.Size) at
System.Windows.FrameworkElement.MeasureCore(System.Windows.Size) at
System.Windows.UIElement.Measure(System.Windows.Size) at
System.Windows.ContextLayoutManager.UpdateLayout() at
System.Windows.UIElement.UpdateLayout() at
Clearly, under some circumstances, GetWindowMinMax() is failing an Assert() of some sort, which is causing an call to Environment.FailFast. What conditions can I check before calling UpdateLayout to ensure that these circumstances do not occur in order to avoid encountering this error?
Take Reflector and peek at the code for
GetWindowMinMax. This is the assert:So it would appear that your window is not really created as a Win32 window yet or its Win32 window is already destroyed.