Skip to content

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

Open

Description

@vsfeedback

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.

Activity

  1. added
    Investigate
    on Dec 18, 2024
  2. Metalfusion commented on Dec 18, 2024

    @Metalfusion

    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.

  3. LennyVC commented on May 19, 2025

    @LennyVC

    Greetings,

    Any updates on this? It is causing issues for us frequently.

  4. tormnator commented on May 20, 2025

    @tormnator

    We also receive regular error reports from our users with the same exception call stack. We have not attempted to verify that this is related to resuming for hibernation, though. WPF 4.x 3D application.

  5. joshucar commented on Jul 2, 2025

    @joshucar

    We are 💯 getting this issue related to hibernation. Our best current workaround is to try to detect the pending hibernation, remove these 3d elements, and reconstruct upon wake. But not super reliable. We are happy to provide any diagnostics/debugging needed to help the WPF team find a resolution!

  6. lindexi commented on Jul 7, 2025

    @lindexi
    Member

    @joshucar Do you means that any wpf application with the 3D element, will OutofMemory after hibernation? Thank you.

  7. joshucar commented on Jul 7, 2025

    @joshucar

    @joshucar Do you means that any wpf application with the 3D element, will OutofMemory after hibernation? Thank you.

    That is what we are seeing, yes. If we have a ModelVisual3D loaded, we will get an OOM when the computer resumes from hibernation or hybrid sleep. We only see this on Windows 11; Windows 10 doesn't seem to cause this issue.

  8. lindexi commented on Jul 8, 2025

    @lindexi
    Member

    @joshucar How about take the DUMP file to analysis?

  9. joshucar commented on Jul 9, 2025

    @joshucar

    @lindexi, what would be a good way to send you what we have - don't think I want to post it here/publicly 🙈

  10. lindexi commented on Jul 10, 2025

    @lindexi
    Member

    @joshucar You can try your self. Just drag the dump file to Visual Studio to analysis. I cannot guarantee the security of your dump data.

  11. LennyVC commented on Aug 12, 2025

    @LennyVC

    Hi!

    Is there anyway we could escalate this issue?

  12. lindexi commented on Aug 13, 2025

    @lindexi
    Member

    @LennyVC Do you meet this issues? Could you take the DUMP file to analysis?

  13. LennyVC commented on Aug 14, 2025

    @LennyVC

    Hi @lindexi !

    Is it possible for you to take a .DMP from the sample VS Solution attached to this ticket?

  14. lindexi commented on Aug 14, 2025

    @lindexi
    Member

    @LennyVC Sorry, I can not repro this issues.

  15. Todilo commented on Aug 14, 2025

    @Todilo

    @LennyVC

    https://drive.google.com/file/d/1JHuMeRPnApaqst3yVgPAA3cILAFCUDaw/view?usp=sharing

    First time creating a dump file so I hope I did it right. I started the sample app. Wait for it to crash and go to error line with the "insufficient memory exception" and then save the .DMP

  16. 10 remaining items

  17. Todilo commented on Sep 4, 2025

    @Todilo

    For those who have been able to reproduce the issue, does it happen on hibernate, sleep, or in both cases?

    Also, I'm not able to reproduce it on Windows 10. Is that something agreed upon, that this is a Windows 11 related issue?

    I am using windows 11 Home, and sleep.

  18. tormnator commented on Sep 12, 2025

    @tormnator

    We added more information to our error reports last week, and we have found one "lead". First, in our case, this is about OutOfMemoryException and the exact same stack trace with UpdateWindowPos as shown in the original post. But, it does not look like this error only happens on wake up. We have 6 error reports since our last release, and 2 of them have come within a few seconds after wake up. But, here's the lead, in all cases, RenderCapability.Tier >> 16 == 0, RenderOptions.ProcessRenderMode == Default, and SystemParameters.IsRemoteSession == False. The computers have a variety of monitor and GPU setups, no pattern there. I'm going to try to gather more information about why the render tier is 0 (e.g. registry information). All computers are Windows 11 (but so are also the vast majority of user computers in general, so this might not mean anything).

    One question for now, obviously, is why are we seeing this OutOfMemoryException in render tier 0?

  19. lindexi commented on Sep 14, 2025

    @lindexi
    Member

    I can't explain this phenomenon, but it is indeed a new "lead". It may means that this doesn't seem to be a universal error, but rather there is a loophole in the implementation of a certain branch.

  20. lindexi commented on Sep 17, 2025

    @lindexi
    Member

    @Todilo @tormnator Could you help me to continue this issue?

    Please run the .NET 10 application demo I built (published together with the debug build of WPF) on your machine and attach Visual Studio to the running process for deeper debugging.

    The .NET 10 application demo:

    Follow these steps:

    1. Launch the .NET 10 app that was published with the debug WPF binaries.
    2. In Visual Studio, open Attach to Process and ensure the Code Type (or selection) includes Native.
    3. Confirm that the symbol file for wpfgfx_cor3.dll — wpfgfx_cor3.pdb — is loaded, and that the loaded wpfgfx_cor3.pdb is the one from the ZIP archive I provided (that archive contains the Debug build with full debugging information).
    4. Open the Breakpoints window and add a C++ function breakpoint for the function named MilInstrumentationCallHRCheckFunction.
    5. Try to reproduce the issue. If the breakpoint is hit, inspect the call stack and local context — this should reveal useful information.
    6. If you cannot step into or otherwise have trouble debugging, use Debug > Save Dump As to create a DUMP file and share that DUMP with me for further analysis.

    Expected result: when the bug is reproduced, Visual Studio should hit the breakpoint in MilInstrumentationCallHRCheckFunction, and the call stack should provide actionable clues.

    And you can find my demo code in https://github.com/lindexi/lindexi_gd/tree/06c5d6c55ce91d1dae25c40c281b32e8318f730a/WPFDemo/DarkerbewurNefelearca

  21. Todilo commented on Sep 17, 2025

    @Todilo

    @Todilo @tormnator Could you help me to continue this issue?

    Please run the .NET 10 application demo I built (published together with the debug build of WPF) on your machine and attach Visual Studio to the running process for deeper debugging.

    The .NET 10 application demo: WPF3DBugTest_NET10_win-x86_Debug.7z

    Follow these steps:

    1. Launch the .NET 10 app that was published with the debug WPF binaries.
    2. In Visual Studio, open Attach to Process and ensure the Code Type (or selection) includes Native.
    3. Confirm that the symbol file for wpfgfx_cor3.dll — wpfgfx_cor3.pdb — is loaded, and that the loaded wpfgfx_cor3.pdb is the one from the ZIP archive I provided (that archive contains the Debug build with full debugging information).
    4. Open the Breakpoints window and add a C++ function breakpoint for the function named MilInstrumentationCallHRCheckFunction.
    5. Try to reproduce the issue. If the breakpoint is hit, inspect the call stack and local context — this should reveal useful information.
    6. If you cannot step into or otherwise have trouble debugging, use Debug > Save Dump As to create a DUMP file and share that DUMP with me for further analysis.

    Expected result: when the bug is reproduced, Visual Studio should hit the breakpoint in MilInstrumentationCallHRCheckFunction, and the call stack should provide actionable clues.

    wpf/src/Microsoft.DotNet.Wpf/src/WpfGfx/shared/util/UtilLib/Instrumentation.h

    Line 130 in ee7cbb8

    MilInstrumentationCallHRCheckFunction(
    And you can find my demo code in https://github.com/lindexi/lindexi_gd/tree/06c5d6c55ce91d1dae25c40c281b32e8318f730a/WPFDemo/DarkerbewurNefelearca
    @lindexi
    I have tried this however I can't get it to crash. Could it be a .net 10 fix? I tried running straight from source-code, though I had to change to .net9 as I have not .net 10 installed. And running then it crashes as expected.
    Edit:
    I also downloaded .net 10.0.10-rc1 with visual studio 2026 insider and run it. Then it still crash.

  22. tormnator commented on Sep 18, 2025

    @tormnator

    @lindexi I have never been able to reproduce the issue on my setup (Lenovo P15s laptop, dock, multiple monitors, Windows 10). I have been further studying the problem today, including adding more data to our internal error reports, and trying various tricks to force the system to fail, or even force render tier 0, without luck. We'll be releasing the next version of our app soon, and will see if the additional data helps (assuming the errors continue).

    My hypothesis--for us--is that the OutOfMemoryException in the render thread happens on laptop computers, often times (but not always) related to connecting to/disconnecting from external monitors.

    I also found a registry key HKEY_CURRENT_USER\SOFTWARE\Microsoft\Avalon.Graphics\IgnoreDwmFlushErrors and saw that the path to VS 2022 was added. This made me do a little AI research on it, and it led me to the following links: https://support.microsoft.com/en-us/topic/june-14-2022-kb5013892-cumulative-update-for-net-framework-3-5-and-4-7-2-for-windows-10-version-1809-and-windows-server-version-2019-39351abe-295b-44ea-8099-65632e28f055 and https://www.perplexity.ai/search/in-the-windows-registry-under-HuK57WIuRZiOSXFwfI60Uw?0=d

    So, maybe this is a known issue after all, and maybe we should also add our app(s) to that registry key? One observation which might support this is that our error logs show that users who get the OOM exception are able to continue the application afterwards. WPF documents seem to indicate that the render thread is "zombied" after the error and will not work anymore, but that does not seem to be the case here. But who knows...

  23. lindexi commented on Sep 18, 2025

    @lindexi
    Member

    @Todilo The main difference point is the application I provided is the debug version.

  24. lindexi commented on Sep 18, 2025

    @lindexi
    Member

    @tormnator Thank you for your experience. And the OOM you receive is from the wpfgfx's HR result value, which not means that the wpf render thread completely break. But in most cases, it will break the render thread.

  25. Todilo commented on Sep 18, 2025

    @Todilo

    @Todilo The main difference point is the application I provided is the debug version.

    @lindexi
    I understand that it is a debug version. I do seem to be getting different behaviours though. Or more precisely if I run from visual studio I get the crash, but running from any published version I do not(tried running as .net 9 as well as .net 10 targeting multiple differnt OS). All published versions work, studio does not.

  26. lindexi commented on Sep 18, 2025

    @lindexi
    Member

    @Todilo Running from VisualStudio will be attached the XAML hot reload, and which may cause some behavior changed.

  27. tormnator commented on Oct 7, 2025

    @tormnator

    I have an update on the OutOfMemoryException. Out application's telemetry is now more detailed and I have included a few incidents in a report at the bottom of this message. The text in the report has been cleaned up by me. What we see is that the computers are laptops; at some point they enter suspended state, and at that point the application's Graphics Rendering Tier is changed to 0. When the computer later resumes from suspended state, the Graphics Rendering Tier does not return to 2 as expected. And then, at some point later, sometimes almost immediately, but other times quite a bit later, the OutOfMemoryException is thrown.

    My hypothesis is that the OutOfMemoryException is legitimate, and that it happens because the application environment runs out of some resource due to running in Graphics Rendering Tier 0 with software rendering. If this is correct, then the primary task now is to see if there's a way to get the application to recover from Graphics Rendering Tier 0, if we somehow can coerce the application to reset/restore Graphics Rendering Tier 2. Secondarily, it would be good to know why it enters Graphics Rendering Tier 0 when entering suspended state, maybe this is correct, maybe not. And finally, it would be good to know why it doesn't restore Graphics Rendering Tier 2 when resuming from suspended state. Here's the report:

    Malin, 1st incident:

    10/01/2025 06:28:57 Application started
    10/01/2025 06:28:58 Console display state on
    10/01/2025 06:28:58 Lid opened
    10/01/2025 06:28:58 Power source AC
    10/01/2025 07:39:01 Console display state off
    10/01/2025 07:15:22 Console display state on
    (Multiple events, including suspending and resuming...)
    10/01/2025 10:29:12 Lid closed
    10/01/2025 10:35:20 Console display state off
    10/01/2025 15:39:55 Power broadcast suspend
    10/01/2025 15:39:55 Computer entered suspended state
    10/01/2025 15:39:56 Graphics Rendering Tier set to 0
    10/03/2025 04:08:07 Lid opened
    10/03/2025 04:08:08 Power broadcast resume from suspend
    10/03/2025 04:08:09 Computer resumed from suspended state
    10/03/2025 04:08:09 Power broadcast resume automatic
    10/03/2025 04:08:09 Console display state on
    10/03/2025 04:08:15 OutOfMemoryException (in UpdateWindowsSettings -> SyncFlush)

    Only the laptop's built-in display is present at the time of the exception


    Malin, 2nd incident:

    10/04/2025 14:04:52 Application started
    10/04/2025 14:04:54 Lid opened
    10/04/2025 14:04:54 Power source AC
    10/04/2025 14:04:54 Console display state on
    10/04/2025 15:37:52 Console display state off
    10/04/2025 15:46:53 Console display state on
    10/04/2025 15:47:23 Console display state off
    10/04/2025 15:53:11 Lid closed
    10/04/2025 15:57:44 Power source DC
    10/04/2025 20:57:45 Computer entered suspended state
    10/04/2025 20:57:45 Power broadcast suspend
    10/04/2025 20:57:45 Graphics Rendering Tier set to 0
    10/05/2025 07:39:19 Lid opened
    10/05/2025 07:39:20 Power broadcast resume automatic
    10/05/2025 07:39:20 Power broadcast resume from suspend
    10/05/2025 07:39:20 Computer resumed from suspended state
    10/05/2025 07:39:20 Console display state on
    10/05/2025 07:39:25 OutOfMemoryException (in UpdateWindowsSettings -> SyncFlush)

    Only the laptop's built-in display is present at the time of the exception


    Terje:

    10/05/2025 14:42:10 Application started
    10/05/2025 14:42:12 Power source AC
    10/05/2025 14:42:12 Console display state on
    10/05/2025 14:42:12 Lid opened
    10/05/2025 15:02:50 Console display state off
    10/05/2025 15:08:17 Power broadcast suspend
    10/05/2025 15:08:18 Computer entered suspended state
    10/05/2025 15:08:18 Graphics Rendering Tier set to 0
    10/05/2025 15:38:27 Power broadcast resume from suspend
    10/05/2025 15:38:27 Computer resumed from suspended state
    10/05/2025 15:38:27 Power broadcast resume automatic
    10/05/2025 15:38:27 Console display state on
    10/05/2025 15:39:38 OutOfMemoryException (in UpdateWindowsSettings -> SyncFlush)

    Only the laptop's built-in display is present at the time of the exception

  28. lindexi commented on Oct 9, 2025

    @lindexi
    Member

    @tormnator Thank you for your detailed experimental records.

    because the application environment runs out of some resource due to running in Graphics Rendering Tier 0 with software rendering

    But I can not find any usable information from the DUMP file, which means that it do not look like the app runs out of the resources.

  29. abenedik commented on Dec 10, 2025

    @abenedik

    I am also very interested in this problem because I am the author of Ab3d.PowerToys library that helps use WPF 3D graphics.

    The link that you posted to get the debug wpfgfx_cor3.dll and .pdb file does not work anymore. But I was able to compile the WPF source code - actually, there were many errors, but I managed to get at least the debug version of wpfgfx_cor3.dll for x86.

    After that, I put a breakpoint in the MilInstrumentationCallHRCheckFunction, as you have instructed.

    After resuming from sleep, I got an error with hr codes with 0x8876086a (D3DERR_NOTAVAILABLE) error after calling pID3D->CheckDeviceType. Then I got a few times 0x8876086a after calling CD3DDeviceLevel1::PresentWithD3D. But after that, the code ran fine and the 3D graphics was correctly shown. There were no E_OUTOFMEMORY that usually happened after resuming from sleep.

    After some experimenting, I found that if I stopped at the first breakpoint, this seems to give enough time to the system (or whatever component) to initialize after sleep. So I changed the breakpoint to add a condition to only break when E_OUTOFMEMORY happened, and then I was finally able to see the problem: after returning from sleep, the WPF code may be executed too quickly - before any hardware render target is available. In this case the code tries to create a software rendering render target and this creation fails. This stops rendering and reports the E_OUTOFMEMORY to the UI thread, crashing the app.

    Here are more details:

    When the WPF app starts for the first time, the code in CMetaRenderTarget::Begin3D calls the FindFirstEnabledRT(&idxFirstEnabledRT):

    BOOL CMetaRenderTarget::FindFirstEnabledRT(
        __out_ecount(1) UINT *pidxFirstEnabledRT
        ) const
    {
        for (UINT i = 0; i < m_cRT; i++)
        {
            if (m_rgMetaData[i].fEnable)
            {
                *pidxFirstEnabledRT = i;
                return TRUE;
            }
        }
    

    On my computer when the app is started the m_cRT is 1 and the m_rgMetaData[0] is:

    m_rgMetaData[0]
    {pInternalRT=0x13f59960 {m_eWindowLayerType=NotLayered (0) } fEnable=1 ptInternalRTOffset={x=0 y=0} ...}
        pInternalRT: 0x13f59960 {m_eWindowLayerType=NotLayered (0) }
        fEnable: 1
        ptInternalRTOffset: {x=0 y=0}
        rcLocalDeviceRenderBounds: {LT(0, 0) RB(1607, 903)  [1607 x 903]}
        rcLocalDevicePresentBounds: {LT(0, 0) RB(1607, 903)  [1607 x 903]}
        pInternalRTHWND: 0x13f59db8 {m_eWindowLayerType=NotLayered (0) }
        pHwDisplayRT: 0x13f59958 {m_eWindowLayerType=NotLayered (0) }
        pSwHWNDRT: 0x00000000 <NULL>
        rcVirtualDeviceBounds: {LT(-16777216, -16777216) RB(16777216, 16777216)  [33554432 x 33554432]}
        rcLocalDeviceValidContentBounds: {LT(0, 0) RB(1607, 903)  [1607 x 903]}
        pIRTBitmap: 0x13f59db8 {m_eWindowLayerType=NotLayered (0) }
        uIndexOfRealRTBitmap: 334862680
        cacheIndex: 0
        fDbgPresentBoundsAreValid: false
    

    Notice the pHwDisplayRT is set, but pSwHWNDRT is null.

    But after resuming from sleep the same code has the following single element in m_rgMetaData:

    m_rgMetaData[0]
    {pInternalRT=0x13f45170 {m_hwnd=0x005010c4 {unused=??? } m_pPresenter=0x13e5b480 {m_pIdealDisplay=0x1424c388 {...} ...} ...} ...}
        pInternalRT: 0x13f45170 {m_hwnd=0x005010c4 {unused=??? } m_pPresenter=0x13e5b480 {m_pIdealDisplay=0x1424c388 {m_pDisplaySet=...} ...} ...}
        fEnable: 1
        ptInternalRTOffset: {x=0 y=0}
        rcLocalDeviceRenderBounds: {LT(0, 0) RB(1607, 903)  [1607 x 903]}
        rcLocalDevicePresentBounds: {LT(0, 0) RB(1607, 903)  [1607 x 903]}
        pInternalRTHWND: 0x13f457b8 {m_hwnd=0x005010c4 {unused=??? } m_pPresenter=0x13e5b480 {m_pIdealDisplay=0x1424c388 {m_pDisplaySet=...} ...} ...}
        pHwDisplayRT: 0x00000000 <NULL>
        pSwHWNDRT: 0x13f45168 {m_hwnd=0x005010c4 {unused=??? } m_pPresenter=0x13e5b480 {m_pIdealDisplay=0x1424c388 {m_pDisplaySet=...} ...} ...}
        rcVirtualDeviceBounds: {LT(-16777216, -16777216) RB(16777216, 16777216)  [33554432 x 33554432]}
        rcLocalDeviceValidContentBounds: {LT(0, 0) RB(1607, 903)  [1607 x 903]}
        pIRTBitmap: 0x13f457b8 {m_hwnd=0x005010c4 {unused=??? } m_pPresenter=0x13e5b480 {m_pIdealDisplay=0x1424c388 {m_pDisplaySet=...} ...} ...}
        uIndexOfRealRTBitmap: 0
        cacheIndex: 334778728
        fDbgPresentBoundsAreValid: false
    

    In this case the pHwDisplayRT is null and instead the pSwHWNDRT is set.

    I was not able to find the code that fills the m_rgMetaData. But I assume that if the FindFirstEnabledRT is executed too soon after resuming from sleep, the system was not yet able to initialize the graphics hardware and because of this tries to use software rendering.

    After that, the code continues on a different path then after the app was started.

    This path starts with the following code (below are the parameters that are passed to the Create function):

        if (!m_pHw3DRT)
        {
            MIL_THR(CHw3DSoftwareSurface::Create(
                m_fmtTarget,
                m_associatedDisplay,
                m_uWidth,
                m_uHeight,
                &m_pHw3DRT
                ));
                
    m_pHw3DRT
    0x00000000 <NULL>            
    
    m_fmtTarget
    BGR32bpp (14)
    m_associatedDisplay
    {value=0 }
        value: 0
    m_uWidth
    1607
    m_uHeight
    903
    

    Now the code tries to create the software render target. But this fails in CD3DModuleLoaderInternal::RegisterSoftwareDevice when calling pID3D->RegisterSoftwareDevice(m_pfnSwRastD3D9GetSWInfo).

    The m_pfnSwRastD3D9GetSWInfo is a pointer to a function at rgb9rast.dll!0x60e826f0 (I have no symbols for that file).

    This call returns E_OUTOFMEMORY that is than propagated to the start and then passed to the main thread.

    Here is the full call stack (I added a new line to the CMetaRenderTarget::Begin3D that starts the path of creating the software RT:

     	wpfgfx_cor3.dll!MilInstrumentationCallHRCheckFunction(HRESULT hr, const unsigned long dwFailureFlags, const HRESULT * const HRList, const unsigned int uiHRListSize, const unsigned int line) Line 152	C++
     	wpfgfx_cor3.dll!CD3DModuleLoaderInternal::RegisterSoftwareDevice(IDirect3D9 * pID3D) Line 738	C++
     	wpfgfx_cor3.dll!CD3DModuleLoader::RegisterSoftwareDevice(IDirect3D9 * pID3D) Line 199	C++
     	wpfgfx_cor3.dll!CDisplaySet::EnsureSwRastIsRegistered() Line 2221	C++
     	wpfgfx_cor3.dll!CD3DDeviceManager::GetSWDevice(CD3DDeviceLevel1 * * ppDevice) Line 284	C++
     	wpfgfx_cor3.dll!CHw3DSoftwareSurface::Create(MilPixelFormat::Enum fmtTarget, DisplayId associatedDisplay, unsigned int uWidth, unsigned int uHeight, CHw3DSoftwareSurface * * const ppHw3DFallbackRT) Line 101	C++
     	wpfgfx_cor3.dll!CSwRenderTargetSurface::Begin3D(const MilRectF & rcBounds, MilAntiAliasMode::Enum AntiAliasMode, bool fUseZBuffer, float rZ) Line 429	C++
    
     	wpfgfx_cor3.dll!CMetaRenderTarget::Begin3D(const MilRectF & rcBounds, MilAntiAliasMode::Enum AntiAliasMode, bool fUseZBuffer, float rZ) Line 491	C++
     	wpfgfx_cor3.dll!CDesktopRenderTarget::Begin3D(const MilRectF & rcBounds, MilAntiAliasMode::Enum AntiAliasMode, bool fUseZBuffer, float rZ) Line 582	C++
     	wpfgfx_cor3.dll!CDrawingContext::Begin3D(const CRectF<CoordinateSpace::LocalRenderingHPC> & rcViewportRect, const CRectF<CoordinateSpace::LocalRenderingHPC> & rcBoundsNode) Line 308	C++
     	wpfgfx_cor3.dll!CDrawingContext::Render3D(CMilVisual3D * pRootVisual3D, CMilCameraDuce * pCamera, const MilPointAndSizeD * pViewport, const CRectF<CoordinateSpace::LocalRenderingHPC> & rcBounds) Line 5760	C++
     	wpfgfx_cor3.dll!CMilViewport3DVisual::RenderContent(CDrawingContext * pDrawingContext) Line 228	C++
     	wpfgfx_cor3.dll!CDrawingContext::PreSubgraph(int * pfVisitChildren) Line 5076	C++
     	wpfgfx_cor3.dll!CGraphIterator::Walk(IGraphNode * pRoot, IGraphIteratorSink * pSink) Line 308	C++
     	wpfgfx_cor3.dll!CDrawingContext::DrawVisualTree(CMilVisual * pRoot, const _D3DCOLORVALUE * pClearColor, const TMilRect_<float,MilRectF,MilPointAndSizeF,RectUniqueness::NotNeeded> & dirtyRect, bool fDrawingIntoVisualBrush) Line 4424	C++
     	wpfgfx_cor3.dll!CDrawingContext::Render(CMilVisual * pRoot, IMILRenderTarget * pIRenderTarget, const _D3DCOLORVALUE * pClearColor, const TMilRect_<float,MilRectF,MilPointAndSizeF,RectUniqueness::NotNeeded> & rcSurfaceBounds, int fFullRender, unsigned int uNumInvalidTargetRegions, const MilRectF * rgInvalidTargetRegions, bool fCanAccelerateScroll, int * pfNeedsFullPresent) Line 6007	C++
     	wpfgfx_cor3.dll!CSlaveHWndRenderTarget::Render(bool * pfNeedsPresent) Line 185	C++
     	wpfgfx_cor3.dll!CRenderTargetManager::Render(bool * pfPresentNeeded) Line 339	C++
     	wpfgfx_cor3.dll!CComposition::Render(bool * pfPresentNeeded) Line 859	C++
     	wpfgfx_cor3.dll!CComposition::ProcessComposition(bool * pfPresentNeeded) Line 712	C++
     	wpfgfx_cor3.dll!CComposition::Compose(bool * pfPresentNeeded) Line 805	C++
     	wpfgfx_cor3.dll!CPartitionThread::RenderPartition(Partition * pPartition) Line 134	C++
     	wpfgfx_cor3.dll!CPartitionThread::Run() Line 234	C++
     	wpfgfx_cor3.dll!CPartitionThread::ThreadMain(void * pv) Line 46	C++
     	kernel32.dll!75465d49()	Unknown
     	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
     	ntdll.dll!77a6d6db()	Unknown
     	ntdll.dll!77a6d661()	Unknown
    

    I hope that this will help you find the solution to the problem. As you have found out, this does not happen on all computers. Here this works fine on Win 11 laptop, but crashes as described above on a brand new high end desktop PC with NVIDIA GPU.

    I am also not sure why this seems to only break when WPF is showing some 3D graphics.

    If you need any additional information, please tell me and I will be glad to help.

  30. lindexi commented on Dec 11, 2025

    @lindexi
    Member

    Thank you @abenedik And I updated the download link in #10192 (comment)

    Your information is very important. As your information says, pID3D->CheckDeviceType will return 0x8876086a(D3DERR_NOTAVAILABLE). And I think this points to the core issue.

    As the https://learn.microsoft.com/en-us/windows/win32/api/d3d9/nf-d3d9-idirect3d9-checkdevicetype document says:

    D3DERR_NOTAVAILABLE is returned if the requested back buffer format is not supported, or if hardware acceleration is not available for the specified formats.

    But I don't know what the next solution will be now. How about wait whatever?

  31. abenedik commented on Nov 30, 2026

    @abenedik

    After some additional time debugging this issue, I prepared a PR that fixes this issue.

    Please check the description in the PR for more info.

    I hope that this will be merged and will come in a update.

    If you would like that I do some additional tests or change something, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Investigate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions