Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application crash on customer machine (Fluent Theme?) #10609

Open
bent-rasmussen opened this issue Mar 20, 2025 · 7 comments
Open

Application crash on customer machine (Fluent Theme?) #10609

bent-rasmussen opened this issue Mar 20, 2025 · 7 comments
Labels
Investigate Requires further investigation by the WPF team. Needs minimal repro project

Comments

@bent-rasmussen
Copy link

bent-rasmussen commented Mar 20, 2025

Description

Our company is now at the point where we want to release our app, built with the new Fluent theme. However, we get a customer reporting a crash on the preview release of our app. The application itself targets .NET 9.0.1.

I asked the customer for the crash dump file and can share it privately with a Microsoft employee.

There appears to be a stackoverflow involved, as can be seen by dumping exceptions via the dumpexceptions command in dotnet dump:

> dumpexceptions
         Address      MethodTable Message Name
    019740818db0     7ff7bfae5ae8 System.ObjectDisposedException
        Message: Cannot access a disposed object.
    0198396f9fb8     7ff7bff61fc8 System.Xaml.XamlObjectWriterException
        Message: Add value to collection of type 'System.Windows.Controls.UIElementCollection' threw an exception.
        StackFrame: MS.Internal.Xaml.Runtime.ClrObjectRuntime.Add(System.Object, System.Xaml.XamlType, System.Object, System.Xaml.XamlType)
    0198396fa3b8     7ff7bff845d0 System.Windows.Markup.XamlParseException
        Message: Add value to collection of type 'System.Windows.Controls.UIElementCollection' threw an exception.
        StackFrame: System.Windows.Markup.XamlReader.RewrapException(System.Exception, System.Xaml.IXamlLineInfo, System.Uri)
    0197415310d8     7ff7c222cf08 Statical.Workspace.RuntimePackageFormatNotSupportedException
        Message: Runtime package format not supported.
    01974157cfd0     7ff7c222cf08 Statical.Workspace.RuntimePackageFormatNotSupportedException
        Message: Runtime package format not supported.
    01974157dbd0     7ff7c222cf08 Statical.Workspace.RuntimePackageFormatNotSupportedException
        Message: Runtime package format not supported.
    01974157e6d0     7ff7c222cf08 Statical.Workspace.RuntimePackageFormatNotSupportedException
        Message: Runtime package format not supported.
    01974157f208     7ff7c222cf08 Statical.Workspace.RuntimePackageFormatNotSupportedException
        Message: Runtime package format not supported.
    01973e800088     7ff7bf6be550 System.OutOfMemoryException
        Message: <null>
    01973e800100     7ff7bf6be678 System.StackOverflowException
        Message: <null>
    01973e800178     7ff7bf6be7a0 System.ExecutionEngineException
        Message: <null>
    01973e81cb88     7ff7bf6be260 System.Exception
        Message: <null>
    0197f0143710     7ff7bf6be260 System.Exception
        Message: s_doneWritingSentinel
    019740067bd8     7ff7c222cf08 Statical.Workspace.RuntimePackageFormatNotSupportedException
        Message: Runtime package format not supported.
    0198383782a8     7ff7bf79b858 System.InvalidOperationException
        Message: Layout recursion reached allowed limit to avoid stack overflow: '2047'. Either the tree contains a loop or is too deep.
        StackFrame: System.Windows.UIElement.PropagateResumeLayout(System.Windows.Media.Visual, System.Windows.Media.Visual)

Note the last exception:

    0198383782a8     7ff7bf79b858 System.InvalidOperationException
        Message: Layout recursion reached allowed limit to avoid stack overflow: '2047'. Either the tree contains a loop or is too deep.
        StackFrame: System.Windows.UIElement.PropagateResumeLayout(System.Windows.Media.Visual, System.Windows.Media.Visual)

The CLR stack trace is enormous:

> clrstack
OS Thread Id: 0x4acc (0)
        Child SP               IP Call Site
0000000C1E006110 00007ff8d7d7ab06 [InlinedCallFrame: 0000000c1e006110] <Module>.malloc(UInt64)
0000000C1E006110 00007ff7bf6e24b5 [InlinedCallFrame: 0000000c1e006110] <Module>.malloc(UInt64)
0000000C1E0060E0 00007FF7BF6E24B5 ILStubClass.IL_STUB_PInvoke(UInt64)
0000000C1E0061A0 00007FF7C1A9DB5A <Module>.new(UInt64)
0000000C1E0061E0 00007FF7C1F786A3 MS.Internal.Text.TextInterface.TextAnalyzer.GetGlyphs(Char*, UInt32, MS.Internal.Text.TextInterface.Font, UInt16, Boolean, Boolean, System.Globalization.CultureInfo, MS.Internal.Text.TextInterface.DWriteFontFeature[][], UInt32[], UInt32, System.Windows.Media.TextFormattingMode, MS.Internal.Text.TextInterface.ItemProps, UInt16*, UInt16*, UInt16*, UInt32*, Int32*, UInt32 ByRef)
0000000C1E0063B0 00007FF7C1F78135 MS.Internal.TextFormatting.LineServicesCallbacks.GetGlyphsRedefined(IntPtr, IntPtr*, Int32*, Int32, Char*, Int32, MS.Internal.TextFormatting.LsTFlow, UInt16*, UInt32*, Int32, Int32 ByRef, UInt16*, UInt16*, Int32*, Int32 ByRef)
0000000C1E006510 00007FF7C02413AD ILStubClass.IL_STUB_ReversePInvoke(Int64, System.IntPtr*, System.Int32*, Int32, System.Char*, Int32, Int32, System.UInt16*, System.UInt32*, Int32, Int32*, System.UInt16*, System.UInt16*, System.Int32*, Int32*)
0000000C1E008588 00007ff82cb1cfd2 [InlinedCallFrame: 0000000c1e008588] MS.Internal.TextFormatting.UnsafeNativeMethods.LoCreateLine(IntPtr, Int32, Int32, Int32, UInt32, IntPtr, MS.Internal.TextFormatting.LsLInfo ByRef, IntPtr ByRef, Int32 ByRef, MS.Internal.TextFormatting.LsLineWidths ByRef)
0000000C1E008588 00007ff7c023f2f2 [InlinedCallFrame: 0000000c1e008588] MS.Internal.TextFormatting.UnsafeNativeMethods.LoCreateLine(IntPtr, Int32, Int32, Int32, UInt32, IntPtr, MS.Internal.TextFormatting.LsLInfo ByRef, IntPtr ByRef, Int32 ByRef, MS.Internal.TextFormatting.LsLineWidths ByRef)
0000000C1E008530 00007FF7C023F2F2 ILStubClass.IL_STUB_PInvoke(IntPtr, Int32, Int32, Int32, UInt32, IntPtr, MS.Internal.TextFormatting.LsLInfo ByRef, IntPtr ByRef, Int32 ByRef, MS.Internal.TextFormatting.LsLineWidths ByRef)
0000000C1E008640 00007FF7C1FC47BE MS.Internal.TextFormatting.TextMetrics+FullTextLine.FormatLine(MS.Internal.TextFormatting.FullTextState, Int32, Int32, Int32, Int32, Int32, MS.Internal.TextFormatting.LineFlags, MS.Internal.TextFormatting.FormattedTextSymbols)
0000000C1E0087A0 00007FF7C1FC2EFF MS.Internal.TextFormatting.TextFormatterImp.FormatLine(System.Windows.Media.TextFormatting.TextSource, Int32, Double, System.Windows.Media.TextFormatting.TextParagraphProperties, System.Windows.Media.TextFormatting.TextLineBreak, System.Windows.Media.TextFormatting.TextRunCache)
0000000C1E008860 00007FF7C2C87483 System.Windows.Controls.TextBlock.MeasureOverride(System.Windows.Size)
0000000C1E008AB0 00007FF7C1FBE58A System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
0000000C1E008EC0 00007FF7C1F483CF System.Windows.UIElement.Measure(System.Windows.Size)
0000000C1E008FF0 00007FF7C1F4A123 System.Windows.Controls.Grid.MeasureCell(Int32, Boolean)
0000000C1E0090A0 00007FF7C1F4A784 System.Windows.Controls.Grid.MeasureCellsGroup(Int32, System.Windows.Size, Boolean, Boolean, Boolean ByRef)
0000000C1E009300 00007FF7C1FC17E3 System.Windows.Controls.Grid.MeasureOverride(System.Windows.Size)
0000000C1E009470 00007FF7C1FBE58A System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
0000000C1E009880 00007FF7C1F483CF System.Windows.UIElement.Measure(System.Windows.Size)
0000000C1E0099B0 00007FF7C3D4875C MS.Internal.Helper.MeasureElementWithSingleChild(System.Windows.UIElement, System.Windows.Size)
0000000C1E009A50 00007FF7C1FBE58A System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
0000000C1E009E60 00007FF7C1F483CF System.Windows.UIElement.Measure(System.Windows.Size)

SNIP

0000000C1E17C150 00007FF7C4EE1161 System.Windows.Controls.WrapPanel.MeasureOverride(System.Windows.Size)
0000000C1E17C320 00007FF7C1FBE58A System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
0000000C1E17C730 00007FF7C1F483CF System.Windows.UIElement.Measure(System.Windows.Size)
0000000C1E17C860 00007FF7C2C80471 System.Windows.ContextLayoutManager.UpdateLayout()
0000000C1E17C970 00007FF7C2C917BE System.Windows.ContextLayoutManager.UpdateLayoutCallback(System.Object)
0000000C1E17C9A0 00007FF7C1FBAE02 System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
0000000C1E17CA00 00007FF7C1FB99CB System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object)
0000000C1E17CAA0 00007FF7C373DBE2 System.Windows.Media.MediaContext.RenderMessageHandler(System.Object)
0000000C1E17CB00 00007FF7C1EFE492 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
0000000C1E17CB80 00007FF7C1EFE272 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
0000000C1E17CBD0 00007FF7C1F02315 System.Windows.Threading.DispatcherOperation.InvokeImpl()
0000000C1E17CC50 00007FF7C1F020A4 MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
0000000C1E17CCB0 00007FF7C1F00E89 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 179]
0000000C1E17CD20 00007FF7C1F01CD9 MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
0000000C1E17CD90 00007FF7C1F019A3 System.Windows.Threading.DispatcherOperation.Invoke()
0000000C1E17CDF0 00007FF7C1F01496 System.Windows.Threading.Dispatcher.ProcessQueue()
0000000C1E17CE90 00007FF7C1F00FCF System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
0000000C1E17CF00 00007FF7C1F00929 MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
0000000C1E17CFA0 00007FF7C1EFE470 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
0000000C1E17D020 00007FF7C1EFE272 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
0000000C1E17D070 00007FF7C1EFFD20 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
0000000C1E17D110 00007FF7C1EFF801 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
0000000C1E17D210 00007FF7BF6E7E4C ILStubClass.IL_STUB_ReversePInvoke(Int64, Int32, Int64, Int64)
0000000C1E17D4C8 00007ff8d7b7ef5c [InlinedCallFrame: 0000000c1e17d4c8] MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
0000000C1E17D4C8 00007ff7bf718fba [InlinedCallFrame: 0000000c1e17d4c8] MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
0000000C1E17D4A0 00007FF7BF718FBA ILStubClass.IL_STUB_PInvoke(System.Windows.Interop.MSG ByRef)
0000000C1E17D560 00007FF87AA2891F System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
0000000C1E17D5F0 00007FF80A46A988 System.Windows.Window.ShowHelper(System.Object)
0000000C1E17D6B0 00007FF80A4612C9 System.Windows.Window.Show()
0000000C1E17D6E0 00007FF80A46167D System.Windows.Window.ShowDialog()
0000000C1E17D7A0 00007FF809A2C8A9 <StartupCode$Prism-Core>[email protected]()
0000000C1E17D8A0 00007FF7C0266500 System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Int32, System.Private.CoreLib],[<StartupCode$Prism-Core>.$Startup+RunAsync@245-31, Prism.Core]].ExecutionContextCallback(System.Object) [/_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs @ 293]
0000000C1E17D8E0 00007FF81E66C344 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 179]
0000000C1E17D950 00007FF7C02663B3 System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Int32, System.Private.CoreLib],[<StartupCode$Prism-Core>.$Startup+RunAsync@245-31, Prism.Core]].MoveNext(System.Threading.Thread) [/_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs @ 372]
0000000C1E17D9C0 00007FF7C026629A System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Int32, System.Private.CoreLib],[<StartupCode$Prism-Core>.$Startup+RunAsync@245-31, Prism.Core]].MoveNext() [/_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncTaskMethodBuilderT.cs @ 350]
0000000C1E17D9F0 00007FF87AA25749 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
0000000C1E17DA50 00007FF87AA25582 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
0000000C1E17DAA0 00007FF87AA2B95C System.Windows.Threading.DispatcherOperation.InvokeImpl()
0000000C1E17DB20 00007FF87A9CDBA7 MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
0000000C1E17DB60 00007FF81E66C344 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [/_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs @ 179]
0000000C1E17DBD0 00007FF87A9CDAF2 MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
0000000C1E17DC30 00007FF87AA2B6E3 System.Windows.Threading.DispatcherOperation.Invoke()
0000000C1E17DC90 00007FF87AA28749 System.Windows.Threading.Dispatcher.ProcessQueue()
0000000C1E17DD30 00007FF87AA28C8D System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
0000000C1E17DDC0 00007FF87A9C3885 MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
0000000C1E17DE50 00007FF87A9C2A56 MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
0000000C1E17DEA0 00007FF87AA25755 System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
0000000C1E17DF00 00007FF87AA25582 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
0000000C1E17DF50 00007FF87AA2741F System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
0000000C1E17DFD0 00007FF87AA27033 System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority, System.Delegate, System.Object)
0000000C1E17E030 00007FF87A9C27B5 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
0000000C1E17E150 00007FF7BF6E7E4C ILStubClass.IL_STUB_ReversePInvoke(Int64, Int32, Int64, Int64)
0000000C1E17E408 00007ff8d7b7ef5c [InlinedCallFrame: 0000000c1e17e408] MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
0000000C1E17E408 00007ff7bf718fba [InlinedCallFrame: 0000000c1e17e408] MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
0000000C1E17E3E0 00007FF7BF718FBA ILStubClass.IL_STUB_PInvoke(System.Windows.Interop.MSG ByRef)
0000000C1E17E4A0 00007FF87AA2891F System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
0000000C1E17E530 00007FF80A4001ED System.Windows.Application.RunDispatcher(System.Object)
0000000C1E17E570 00007FF80A3FEAA2 System.Windows.Application.RunInternal(System.Windows.Window)
0000000C1E17E5D0 00007FF80EC74AAD Statical.Prism.App.Main()

Reproduction Steps

N/A

Expected behavior

Crash 💥

Actual behavior

Crash 💥

Regression?

We think this may be related to the new Fluent Theme, as we have not had this kind of crash before. Well, at least not with WPF...

Known Workarounds

None

Impact

The customer cannot use our application since it often crashes or freezes for them. We are unsure how many customers this affects, since we have not shipped the next major version with the Fluent Theme version yet - only a preview version.

We instructed the customer to update to the latest Windows version and update graphics drivers, since we have had issues with that before. The customer has done so but it has not resolved the issue.

Configuration

From the customer:

Image

Other information

No response

@miloush
Copy link
Contributor

miloush commented Mar 20, 2025

Would you have a repro? It might be challenging to figure this out from a crash dump. I am assuming you are confident there isn't a layout recursion or a tree too deep. Does it crash for the customer without using the Fluent theme?

Please also note that the Fluent theme is experimental and I wouldn't advise to use it in stable releases yet.

@bent-rasmussen
Copy link
Author

bent-rasmussen commented Mar 20, 2025

There is also an Out of Memory Exception in the stack trace, yet a screenshot from the customers task manager shows that only 50% of the physical memory of the machine is in use (48 GB total physical memory).

Would you have a repro?

Well not isolated from our app. It occurs on this customers machine.

I am assuming you are confident there isn't a layout recursion or a tree too deep.

No, this is the first time I've heard the term "layout recursion". I do not know how to detect those issues.

Please also note that the Fluent theme is experimental and I wouldn't advise to use it in stable releases yet.

When we look at the documentation, to us it looks like it is only the ThemeMode struct and the ThemeMode property that is experimental, not the entire Fluent Theme. At least, that is why we started building on the Fluent Theme already. We do not attempt to set the ThemeMode property at the Application or Window level.

@miloush
Copy link
Contributor

miloush commented Mar 20, 2025

An example of layout recursion would be if an element is a child of itself (though I don't think you can do that directly), or if template tries to instantiate something that also uses that template, etc.

I agree the What's new page did not make it too clear. A bit stronger wording was added to https://github.com/dotnet/wpf/blob/main/Documentation/docs/using-fluent.md. You can also see the list of open theme related issues: https://github.com/dotnet/wpf/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22Win%2011%20Theming%22. Yours might be another.

There might be other reasons for OOM other than directly memory, such as running out of GDI handles. If your app is running as 32-bit, it runs out of memory at a few GB.

If your customer is running into the issue pretty reliably, it might be worth trying to see if it repros for them for the same version of the app without the fluent theme enabled.

Otherwise, when you see the whole stack, you should be able to follow your XAML design and see which element it dives into.

@siagupta0202 siagupta0202 added Needs minimal repro project Investigate Requires further investigation by the WPF team. labels Mar 21, 2025
@bent-rasmussen
Copy link
Author

Thanks for the assistance, Jan.

Yes indeed, on that page there is a note that says the entire Fluent theme is experimental. We haven't seen that note before, maybe because it wasn't referenced in the release notes.

There might be other reasons for OOM other than directly memory, such as running out of GDI handles. If your app is running as 32-bit, it runs out of memory at a few GB.

The app is 64 bit.

If your customer is running into the issue pretty reliably, it might be worth trying to see if it repros for them for the same version of the app without the fluent theme enabled.

The new app version only supports the Fluent theme, that is the main feature of it. We would have to make some code changes to even make it possible to test without Fluent theme.

We will try to make an experiment to untangle Fluent theme from the app. For example we probably need the text styles and colors to still be defined (which are referenced in XAML and in code). We will then send this to the customer to try out, then we should get a definite determination of whether this is Fluent theme related. In any event, a crash should not happen, Fluent theme or not.

I guess the question now is whether Fluent theme will be stable in .NET 10, if there are any promises from Microsoft to that effect, or if we should change course. We are fine with some future API changes but expect every version to work "In the wild". We can't wait until .NET 11 to have a stable product.

@bent-rasmussen
Copy link
Author

bent-rasmussen commented Mar 21, 2025

I agree the What's new page did not make it too clear. A bit stronger wording was added to https://github.com/dotnet/wpf/blob/main/Documentation/docs/using-fluent.md.

This note was made after the release of Fluent theme:

Image

Somewhat unsatisfactory expectation management, I would say.

Will this issue be closed without a minimal repro? (We would object to that).

As mentioned in the original post, we have a crash dump that we can share privately with Microsoft.

@bent-rasmussen
Copy link
Author

You are right Jan, it is layout recursion!

System.InvalidOperationException: Layout recursion reached allowed limit to avoid stack overflow: '2047'. Either the tree contains a loop or is too deep.
   at System.Windows.UIElement.PropagateResumeLayout(Visual parent, Visual v)
   at System.Windows.Media.Visual.AddVisualChild(Visual child)
   at System.Windows.Controls.Panel.GenerateChildren()
   at System.Windows.Controls.StackPanel.StackMeasureHelper(IStackMeasure measureElement, IStackMeasureScrollData scrollData, Size constraint)
   at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

@miloush
Copy link
Contributor

miloush commented Mar 21, 2025

Right, I think it is critical to identify which controls in the stack correspond to which elements in your UI. You might be able to do that from a crash dump. Check that the heap does not in fact contain 2k different controls. If it doesn't help, time-travel trace might be more helpful.

I am afraid I don't think there is much that can be done without a repro. You might need to open a support case. You could also probably add some telemetry in the app to guide you in diagnosing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigate Requires further investigation by the WPF team. Needs minimal repro project
Projects
None yet
Development

No branches or pull requests

3 participants