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

WPF 3D model example throws OutOfMemoryException from render thread after resuming from hibernation #10192

Open
vsfeedback opened this issue Dec 18, 2024 · 1 comment
Labels
Investigate Requires further investigation by the WPF team.

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:Other]
Using the Viewport3D and GeometryModel3D features in .NET 4.8 application seem to always cause an exception when Windows 11 computer resumes from hibernation.

Applying this example XAML into the WPF application template in Visual Studio 2022 produces an application which will throw after computer is hibernated and resumed.
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-3-d-scene?view=netframeworkdesktop-4.8#create-a-3d-scene-in-xaml

Sample VS solution:
WPF3DBugTest.zip

Issue repro steps:

  1. Build the provided application with Visual Studio 2022
  2. Configure Visual Studio to stop on OutOfMemoryException and run the application with debugger attached
  3. Hibernate Windows
  4. Turn computer back on and login
  5. Try to move or resize the application window
  6. Visual Studio stops on exception, resuming closes the application.

I have noted that running the application without debugger attached might not cause visible issues, or the repro steps might not be reliable. However, in a more complex application utilizing WPF 3D features an exception always occurs.

The crash occurs as OutOfMemoryException is thrown in WPF render thread.

System.OutOfMemoryException
HResult=0x8007000E
Message=Insufficient memory to continue the execution of the program.
Source=PresentationCore
StackTrace:
at System.Windows.Media.Composition.DUCE.Channel.SyncFlush()
at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)
at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in MS.Win32\HwndWrapper.cs:line 221
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) in MS.Win32\HwndSubclass.cs:line 253
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) in System.Windows.Threading\ExceptionWrapper.cs:line 73
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) in System.Windows.Threading\ExceptionWrapper.cs:line 24
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) in System.Windows.Threading\Dispatcher.cs:line 1021
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) in MS.Win32\HwndSubclass.cs:line 207

Windows information:
Edition Windows 11 Pro
Version 24H2
OS build 26100.2314
Experience Windows Feature Experience Pack 1000.26100.32.0


Original Comments

Feedback Bot on 11/20/2024, 07:21 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

@himgoyalmicro himgoyalmicro added the Investigate Requires further investigation by the WPF team. label Dec 18, 2024
@Metalfusion
Copy link

A workaround seems to be to minimize the application window before hibernating. However, this is not feasible to do programmatically as trying to minimize the app window from the Windows system power management "suspend" event handler doesn't help.

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.
Projects
None yet
Development

No branches or pull requests

3 participants