Skip to content

Crash when CEF window is Invoked in Net8 WPF C# #5029

Description

@mojiwa

Is there an existing issue for this?

  • 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    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