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

Random application crash: CreateSwapChainForHwnd failed #17837

Closed
AngryCarrot789 opened this issue Dec 27, 2024 · 2 comments
Closed

Random application crash: CreateSwapChainForHwnd failed #17837

AngryCarrot789 opened this issue Dec 27, 2024 · 2 comments

Comments

@AngryCarrot789
Copy link

AngryCarrot789 commented Dec 27, 2024

Describe the bug

I got this crash when I was moving my mouse around some MenuItems in my window's Menu. I assume it tried to open a tooltip at one point but failed to do so judging by the stack trace.

I'm using Win32CompositionMode.LowLatencyDxgiSwapChain and Win32RenderingMode.AngleEgl

To Reproduce

Use the above composition mode and rendering mode, and open a top level menu item and move your cursor somewhat slowly up and down the menu, and when it tries to show a tooltip for that item, it might crash but it might also not

Expected behavior

Not really sure, could maybe log the error to the console and just let the tooltip be a black square?

Avalonia version

11.2.2

OS

Windows

Additional context

I have a splash screen window that shows first, then a startup page, then my main window which contains the menu. The app doesn't directly load into the main window. not sure if this matters.

Here's the stack trace:

System.Runtime.InteropServices.COMException (0x80070005): CreateSwapChainForHwnd failed
   at Avalonia.Win32.DirectX.Impl.__MicroComIDXGIFactory2Proxy.CreateSwapChainForHwnd(IUnknown pDevice, IntPtr hWnd, DXGI_SWAP_CHAIN_DESC1* pDesc, DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc, IDXGIOutput pRestrictToOutput)
   at Avalonia.Win32.DirectX.DxgiRenderTarget..ctor(IEglWindowGlPlatformSurfaceInfo window, EglContext context, DxgiConnection connection)
   at Avalonia.Win32.DirectX.DxgiSwapchainWindow.CreateGlRenderTarget(IGlContext context)
   at Avalonia.Skia.GlRenderTarget..ctor(GRContext grContext, IGlContext glContext, IGlPlatformSurface glSurface)
   at Avalonia.Skia.GlSkiaGpu.TryCreateRenderTarget(IEnumerable`1 surfaces)
   at Avalonia.Skia.SkiaContext.CreateRenderTarget(IEnumerable`1 surfaces)
   at Avalonia.Rendering.PlatformRenderInterfaceContextManager.CreateRenderTarget(IEnumerable`1 surfaces)
   at Avalonia.Rendering.Composition.Server.ServerCompositor.CreateRenderTarget(IEnumerable`1 surfaces)
   at Avalonia.Rendering.Composition.Server.ServerCompositionTarget.Render()
   at Avalonia.Rendering.Composition.Server.ServerCompositor.RenderCore(Boolean catchExceptions)
   at Avalonia.Rendering.Composition.Server.ServerCompositor.RenderReentrancySafe(Boolean catchExceptions)
   at Avalonia.Rendering.Composition.Server.ServerCompositor.Render(Boolean catchExceptions)
   at Avalonia.Rendering.Composition.Server.ServerCompositor.Render()
   at Avalonia.Rendering.RenderLoop.TimerTick(TimeSpan time)```
@timunie
Copy link
Contributor

timunie commented Dec 27, 2024

Please file a minimum sample as this seems to be hard to reproduce.

@AngryCarrot789
Copy link
Author

It turns out the app wasn't crashing, I guess I was hitting the wrong button while debugging. The exception gets thrown and Rider was catching it, but it never crashes the app, it gets handled somewhere.

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

No branches or pull requests

2 participants