Skip to content

Missing DEBUG_EXCEPTION_CATCH_HANDLER_FOUND events for exceptions during func eval #125777

@tommcdon

Description

@tommcdon

Description

Missing DEBUG_EXCEPTION_CATCH_HANDLER_FOUND events for exceptions during func eval.

Same scenario as described in #102178. Looks like the regression was introduced in #119784, specifically this change:

When SfiNext reached native marker state, it was doing one more unwind to get to the frame function state. That is benign for non-interpreter scenarios, as it doesn't change the regdisplay, but it is useless due to that. But for interpreter, it can actually incorrectly move to interpreted code. The fix is to not to do that unwind and just return.

Reproduction Steps

  1. Create the following program targeting .NET 11 Preview 2
  2. Set a breakpoint on the specified line
  3. Evaluate Divide(5, 0) in the debugger. If using Visual Studio, use the immediate Window so that the debugger will stop on the exception
using System.Diagnostics;

static class Program
{
    static int Divide(int n, int m)
    {
        return n / m;
    }

    static void Main(string[] args)
    {
        Console.WriteLine("10/2 = {0}", Divide(10, 2)); // breakpoint here
    }
};

Expected behavior

The debugger should raise an exception callback with DEBUG_EXCEPTION_CATCH_HANDLER_FOUND. In Visual Studio, if evaluating from the immediate Window, this will cause the debugger to break on the exception.

Actual behavior

No catch-handler-found event is raised

Regression?

Regression from .NET 10.

Known Workarounds

None

Configuration

All configs

Other information

No response

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions