Debugger not stopping at breakpoint when there's an exception within a LINQ lambda.

Options

Here's a quick repro:

try
{
    new[]{0}.Select<int, int>(_ =>
    {
        throw new NotImplementedException();
    }).ToList();
}
catch (Exception ex)
{
    throw; // breakpoint here
}

When the breakpoint is set, execution stops within the lambda causing some confusion.

In my particular case, the catch block of the intended breakpoint has some needed context for debugging and is making it unnecessarily difficult to track.

Comments