Diagnose a .NET breakpoint with no loaded symbols

A hollow breakpoint usually means the debugger cannot bind that source location to the code currently loaded in the process. Start with the loaded module. A successful build in your working directory does not prove that the running application loaded that build.

For managed code, a portable PDB maps compiled code to source locations. Visual Studio requires symbols that match the binary. Renaming an unrelated PDB or putting a newer PDB beside an older assembly does not make them a matching pair.

Create a known Debug build

Install the .NET 10 SDK and use Visual Studio with .NET 10 support for the interactive debugging steps. Create a disposable console project with dotnet new console -n SymbolsDemo -f net10.0. Replace SymbolsDemo/Program.cs with:

C#
using System;
using System.IO;
using System.Reflection;

var assembly = Assembly.GetExecutingAssembly();
var location = assembly.Location;
Console.WriteLine($"Assembly={Path.GetFileName(location)}");
Console.WriteLine($"PDB beside assembly={File.Exists(Path.ChangeExtension(location, ".pdb"))}");
Console.WriteLine($"Module path={location}");
Console.WriteLine($"Module version ID={assembly.ManifestModule.ModuleVersionId}");
Console.WriteLine("Set a breakpoint on this line.");

From the parent directory, build and run the same configuration:

Plain text
dotnet build SymbolsDemo -c Debug
dotnet run --project SymbolsDemo -c Debug --no-build

The first two lines should report Assembly=SymbolsDemo.dll and PDB beside assembly=True. The full path and module version ID depend on the build and machine. They identify the actual assembly observed by this process. The final line gives you a concrete executable statement on which to place a breakpoint.

The ordinary SDK Debug build creates symbols. If an existing project overrides that behavior, inspect its effective DebugType, DebugSymbols and Optimize properties. Portable PDB is the usual managed format. Embedded PDB is another valid configuration, so the adjacent-file check alone is not a universal symbol test.

Inspect the running module

Open the project in Visual Studio and select the intended startup project and Debug configuration. Start this short console demo with Debug → Step Into (F11) so execution stops at its first statement before the program can exit. Then open Debug → Windows → Modules. Locate the assembly that owns the breakpoint and inspect its path and symbol status.

If the module is missing, check that you attached to the correct process and that the relevant code has actually loaded. A service, test runner or child process may execute the code instead of the process you first attached to. A library that is never loaded cannot bind its breakpoints.

If the path points to another deployment, test output or stale copy, correct the launch or deployment path. Rebuilding the project that is not running will not fix this mismatch. Preserve the binary and PDB from the same build when copying artifacts.

Follow the symbol-loading evidence

For a loaded module without symbols, use its Symbol Load Information context-menu command to inspect where the debugger looked and why it rejected a candidate. Load the matching PDB from your actual build output or the configured symbol source. Symbol availability for a different module does not establish anything about this one.

When symbols load but a breakpoint still cannot bind, inspect the source file associated with that frame. Compare the running build with the source revision on disk. Source checksum validation helps identify stale or different source. Disabling that check can make the debugger display misleading lines, so repair the source/build pairing first.

Finally, distinguish a binding problem from execution behavior. Optimized code can move or remove statements. Conditional compilation can exclude the selected line. A breakpoint on a declaration or blank line may move to a nearby executable statement. A correctly bound breakpoint is still not hit if the tested path never executes.

Verify the repair

Repeat the same launch and confirm the module path, a successful symbol status and a bound breakpoint that stops on a known executed statement. The console diagnostics can run unattended, but they do not prove Visual Studio loaded the PDB. The final debugger observations require an actual debugging session on the affected application.

References

Symbol / PDB files in the Visual Studio debugger
Configure symbol files (PDB) and source files in the Visual Studio debugger for C#, C++, Visual Basic, and F# applications.
https://learn.microsoft.com/en-us/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger?view=visualstudio
Troubleshoot breakpoints in the debugger - Visual Studio
If a breakpoint is disabled or couldn't be set, it's displayed as a hollow circle. Look here information on problems that can occur when setting breakpoints.
https://learn.microsoft.com/en-us/troubleshoot/developer/visualstudio/debuggers/troubleshooting-breakpoints
Compiler Options - code generation options - C# reference
C# Compiler Options to control code generation. The options affect the code generated by the compiler for a given compilation.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/code-generation
Overview of the debugger - Visual Studio (Windows)
Get started debugging your applications by using the Visual Studio debugger and see what your code is doing while it runs.
https://learn.microsoft.com/en-us/visualstudio/debugger/debugger-feature-tour

Question provenance

This article addresses How do I remedy "The breakpoint will not currently be hit. No symbols have been loaded for this document." warning? , asked by Instance Hunter on Stack Overflow. The source question is licensed under CC BY-SA 4.0 . The explanation and examples here are newly authored for current .NET. No answer text or code is reproduced.

Author: Herman Schoenfeld