Question

I've created a NuGet package and while testing it I found that whenever stepping into a method in the package Visual Studio shows the code, I would like it to not be the case.

The package has been built under a Release configuration.

What is needed in order to disable step-through the code of the package classes ?

Was it helpful?

Solution

Are you publishing the PDB files with your NuGet package? If so, Visual Studio is doing the expected behaviour of allowing you to step in.

If you definitely want to include the PDB, you'll need to add the [DebuggerStepThrough] attribute to every class in your assembly. This will however make debugging a nightmare for you, unless you use a #if BLAH hash-define condition to only do this in Release mode.

My suggestion would be to not include the PDBs in your NuGet package, then you don't need to amend your code at all.

OTHER TIPS

Use the DebuggerHidden attribute on your classes. The DebuggerNonUserCode and DebuggerStepThrough attributes would also work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top