Visit NES for .NET Home Page

Debugging with Visual Studio

Why Visual Studio's debugger can refuse to attach to a NES for .NET runtime with a signature validation error, and how to resolve it.

Signature validation errors in Visual Studio

When you attach the Visual Studio debugger to an application running on a NES for .NET runtime, you may see this error:

Unable to attach to CoreCLR. Signature validation failed for a .NET Runtime Debugger library because the file is unsigned.

Why it happens

Visual Studio 2022 version 17.5 and later checks that the debugger libraries shipped with the .NET runtime are signed by Microsoft before it loads them. NES for .NET runtimes are built by HeroDevs, not Microsoft, so these libraries don't carry Microsoft's signature, and Visual Studio refuses to attach. The error is expected with NES for .NET and does not mean your download is damaged.

What to do

Turn off this check in Visual Studio. Microsoft documents three ways to do it:

  • Environment variable (recommended). In a command prompt, run set VSDebugger_ValidateDotnetDebugLibSignatures=0, then start Visual Studio (devenv.exe) from that same prompt. The setting applies only to that Visual Studio instance.
  • DOTNET_ROOT. Start Visual Studio from a command prompt where DOTNET_ROOT points at the NES for .NET installation. Visual Studio then ignores unsigned debugger libraries under that directory.
  • Registry setting. A persistent setting exists, but Microsoft does not recommend it.

For complete, up-to-date steps, follow Microsoft's official guide, Resolving Signature Validation Errors in Visual Studio.

If the error persists after following these steps, contact your HeroDevs support representative.