Skip to content

.NET 10 JIT crashes with access violation when compiling calls to C++/CLI functions returning structs with aggregate initialization #123748

@twoelfer

Description

@twoelfer

Description

Environment:
SDK-Version: 10.0.102
Microsoft.NETCore.App 10.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 10.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Visual Studio 2026, Jan 2026 Update, 18.2.1
x64 Build, Release only (doesn't happen in Debug builds)
Application is a c# windows desktop app, calling into c++/cli, calling into c++ native.

Symptoms:
• Exception: 0xC0000005: Access violation reading location 0x0C
• Location: clrjit.dll during JIT compilation
• Happens when managed C# calls C++/CLI code that returns structs with aggregate initialization

Context:

  • This worked fine with net 4.8
  • TieredCompilation settings didn't help
  • Multiple aggregate returns in call chain compound the issue

TieredCompilation settings that i tried and that didn't help:

false
false
false
full

Reproduction Steps

It's a really big app (> projects, thousends of classes), i only have a pattern, not something that actually compiles.

// C++ Native
struct MyStruct { double a, b, c; };
MyStruct GetValue() {
return { 1.0, 2.0, 3.0 }; // ← Triggers JIT crash in .NET 10
}

// C++ Native
struct MyStruct { double a, b, c; };
MyStruct GetValue() {
return { 1.0, 2.0, 3.0 }; // ← Triggers JIT crash in .NET 10
}

Expected behavior

shouldn't crash in the jitter

Actual behavior

crashes in the jitter

Regression?

yes, this did work in .net framwork 4.8

Known Workarounds

removed the aggregate returns and replaced them with normal initialization of struct.

Configuration

  • net core 1.0.0.2 (with windows desktop)
  • windows 11 25H2, build 26200.7019
  • x64
  • all of my machines have this setup

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions