Crash when CEF window is Invoked in Net8 WPF C#
Is there an existing issue for this?
- [X] I have searched both open/closed issues, no issue already exists.
CefSharp Version
131.3.10
Operating System
Windows 11
Architecture
x64
.Net Version
Net 8.0
Implementation
WPF
Reproduction Steps
Implemented a CEF window in a C# NET8 WPF application. When the CEF window is invoked the application crashes. This didn't happen in the prior version (131.2.70) but happens from 131.3.10 onwards (I've also tried in 131.3.50). I've looked through the release notes but cannot see anything that might explain this - but I might have missed something.
I don't get much of a stack trace either, but using WinDBG I get this:
Faulting module name: libcef.dll, version: 131.3.1.0, time stamp: 0x674e351a
Exception code: 0x80000003
Fault offset: 0x00000000017409e3
Faulting process id: 0x0x95A4
Faulting application start time: 0x0x1DB603934398776
Faulting application path: <HIDDEN>
Faulting module path: <HIDDEN>\libcef.dll
Report Id: b17e2027-2d5d-44a7-91f3-fe0b8eab0081
Further investigation with breakpoints pointed to CEF crashing here:
[return: MarshalAs(UnmanagedType.U1)]
internal unsafe static bool _003FRelease_0040CefSharpApp_0040Internals_0040CefSharp_0040_0040_0024_0024F_00244PPPPPPPM_0040A_0040EBA_NXZ(CefSharpApp* P_0)
{
//IL_000a: Expected I, but got I8
CefSharpApp* num = P_0;
P_0 = (CefSharpApp*)((ulong)(nint)num - (ulong)(*(int*)((byte*)num + -4)));
return CefSharp_002EInternals_002ECefSharpApp_002ERelease(P_0); // here crashes to be exact
}
I really hope it's just something simple we've not implemented that's causing this. But right now we cannot update beyond 131.2.70.
Expected behavior
The window opens as expected
Actual behavior
The entire application crashes
Regression?
Yes, this worked fine in 131.2.70
Known Workarounds
None
Does this problem also occur in the CEF Sample Application
Not Tested
Other information
No response
Did you test with the MinimalExample?
Browser loads just fine for me. I've not seen any other reports.
Implemented a CEF window in a C# NET8 WPF application. When the CEF window is invoked the application crashes.
Works just fine in the MinimalExample. I've tested with .Net 8.0, no issues.
Try performing a clean checkout after upgrading.
Same problem here with .NET 9.0 and WPF. Only crashes when I start the application with an argument from a desktop link.
Same problem here with .NET 9.0 and WPF. Only crashes when I start the application with an argument from a desktop link.
What is the WorkingDirectory when you launch your application via the desktop link compared to direct execution?
TBH it's unlikely your issue has the same cause.
I have the same error after upgrading to version 131.3.10, the latest version also throws an exception. It does not happen on all computers, only on 2 out of 10, the settings are the same everywhere.
Faulting application name: TechSupport3.exe, version: 3.4.2.0, time stamp: 0x67580000
Faulting module name: libcef.dll, version: 131.3.5.0, time stamp: 0x6761c11b
Exception code: 0x80000003
Fault offset: 0x0000000006e720c1
Faulting process id: 137ac
Faulting application start time: 01db77e486ffa371
Faulting application path: C:\Users\user\AppData\Local\TechSupport3\current\TechSupport3.exe
Faulting module path: C:\Users\user\AppData\Local\TechSupport3\current\libcef.dll
Report Id: 625dede2-8940-4c96-b37e-273d3ddfcac8
Faulting package full name:
Faulting package-relative application ID:
Has anyone found the cause?
Exception code: 0x80000003
A breakpoint has been hit. You will need to gather more information.
- https://github.com/cefsharp/CefSharp/wiki/Trouble-Shooting#log-file
- https://github.com/cefsharp/CefSharp/wiki/Trouble-Shooting#unmanaged-crashes-when-the-process-dies
Did you test with the MinimalExample?
As above. Please test with the MinimalExample.
It does not happen on all computers, only on 2 out of 10
What is different about the 2 machines?
As above. Please test with the MinimalExample.
I can't compile MinimalExample for .Net 9, but for .Net 7 MinimalExample works on those two machines
In debug.log
[0207/120935.052:INFO:crash_reporting.cc(209)] Crash reporting enabled for process: browser
[0207/120935.709:INFO:crash_reporting.cc(209)] Crash reporting enabled for process: gpu-process
[0207/120935.731:INFO:crash_reporting.cc(209)] Crash reporting enabled for process: utility
[0207/120935.878:INFO:crash_reporting.cc(209)] Crash reporting enabled for process: utility
[0207/120938.249:INFO:crash_reporting.cc(209)] Crash reporting enabled for process: utility
[0207/120952.347:INFO:crash_reporting.cc(209)] Crash reporting enabled for process: renderer
[0207/120952.374:INFO:crash_reporting.cc(209)] Crash reporting enabled for process: renderer
[0207/120957.883:INFO:crash_reporting.cc(209)] Crash reporting enabled for process: utility
I have a crash dump, but I don't know what to do with it.
P.S. MinimalExample compiled for .Net 9 also works
Firstly make sure you have an app.manifest see https://github.com/cefsharp/CefSharp/wiki/Quick-Start-For-MS-.Net-5.0-or-greater#40-add-appmanifest-to-your-application
I have a crash dump, but I don't know what to do with it.
Download the matching pdb and open the dump in VS.
https://github.com/cefsharp/CefSharp/wiki/Trouble-Shooting#loading-native-symbols-for-easier-diagnosis