-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Closed
Copy link
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIbug
Milestone
Description
Reproduction:
using System;
using System.Runtime.CompilerServices;
Problem();
[MethodImpl(MethodImplOptions.NoInlining)]
static void Problem()
{
[MethodImpl(MethodImplOptions.NoInlining)]
static int Call() => throw new Exception("Thrown from 'Call'");
var a = Call();
ClassWithCctor.StaticField = a;
}
class ClassWithCctor
{
public static int StaticField;
static ClassWithCctor() => throw new Exception("Thrown from 'ClassWithCctor'");
}Compile and run.
Expected result: the exception from Call is thrown.
Actual result: the type initializer throws instead:
Unhandled exception. System.TypeInitializationException: The type initializer for 'ClassWithCctor' threw an exception.
---> System.Exception: Thrown from 'ClassWithCctor'Cause - the insertion point of the helper here:
runtime/src/coreclr/jit/importer.cpp
Lines 16140 to 16143 in aafa910
| if (helperNode != nullptr) | |
| { | |
| op1 = gtNewOperNode(GT_COMMA, op1->TypeGet(), helperNode, op1); | |
| } |
category:correctness
theme:basic-cq
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIbug