dotnet / dotnet/roslyn

Debug breakpoint step over throws an access violation exception

Open
#73,389 0 comments 0 reactions 1 assignee View on GitHub

@tmat is already working on this.

Since Jul 2, 2024.

Area-Interactive
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

Debug breakpoint step over (F10) causes the debugger to immediately close without any catchable exception.
A console output access violation error message is visible.
The incident occurs only when the debug break point is hit.

Version Used:

Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.9.2
Windows 10 Pro
C# net 8.0 Console Application

Steps to Reproduce:

Here you can find a small solution to reproduce the issue.
ConsoleThread_Test1.zip

The application start an infinite background thread and stop it.

When a debug break point is set on line 74 or 75 (Manager.cs class file), after hit, performing a step over closes the debugger and output following message:
The program '[16356] ConsoleThread_Test1.exe' has exited with code 3221225477 (0xc0000005) 'Access violation'.

breakpoint location

The application works fine without the debug breakpoint in that precise code line.
The error do not occur if the line 75 (if (IsWorking)) is removed or the private backfield is used instead.
The error do not occur if the line 89 (foreach (BaseScene scene in m_Cache.Values)) is removed or m_Cache is used instead.

Here the Windows event viewer report about the incident:

Faulting application name: ConsoleThread_Test1.exe, version: 1.0.0.0, time stamp: 0x65a80000
Faulting module name: ntdll.dll, version: 10.0.19041.4239, time stamp: 0xad5435e9
Exception code: 0xc0000005
Fault offset: 0x0000000000031548

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.