Skip to content

How to handle exceptions thrown in GraphicsCapture.dll #2499

@YueLu0116

Description

@YueLu0116

I use WinRT Windows.Graphics.Capture to capture screens or windows. My code is almost identical to WebRTC's implementation. However, our customers are experiencing crashes.

Stack trace:
KERNELBASE!RaiseException+0x69
ucrtbase!CxxThrowException+0xad
GraphicsCapture!winrt::throw_hresult+0x1de
GraphicsCapture!winrt::Windows::Graphics::Capture::implementation::Direct3D11CaptureFramePool::PresentThread+0x145
KERNEL32!BaseThreadInitThunk+0x14
ntdll!RtlUserThreadStart+0x21

Some basic information I found
I find the PresentThread was started in ABI::Windows::Graphics::Capture::IGraphicsCaptureSession::StartCapture
The calling codes: https://webrtc.googlesource.com/src/+/refs/heads/main/modules/desktop_capture/win/wgc_capture_session.cc#217

I investigated the crash information:
ExceptionAddress: 00007fff2f3fb699 (KERNELBASE!RaiseException+0x0000000000000069)
ExceptionCode: e06d7363 (C++ EH exception)
ExceptionFlags: 00000001
NumberParameters: 4
Parameter[0]: 0000000019930520
Parameter[1]: 000000d7662ff760
Parameter[2]: 00007ffef8f7e788
Parameter[3]: 00007ffef8f60000

Checking Parameter[1], which is pExceptionObject:
dd 000000d7662ff760
000000d7662ff760 00000000 00000000 aabbccdd 887a0005
000000d7662ff770 9018c0e8 0000023b f150c3a8 0000023b

0x887a0005 indicates "device lost".
The function that throws this exception in GraphicsCapture.dll isxxxDirect3D11CaptureFramePool::ProcessFrame

How can I catch this type of exception (which occurs in a thread created by Windows)? Should I use VEH?

Metadata

Metadata

Assignees

Labels

Pri3Topic is in the bottom 50% of page views for the repo or was not created via Feedback control.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions