DEV Community 👩‍💻👨‍💻

vbilopav
vbilopav

Posted on

Step Into Norm for .NET with Nuget Source Links

There is an interesting discussion od reddit around the Growing the .NET ecosystem document.

It revolves around the important question should we trust the 3-rd party libraries from NuGet, or should we only stick to the Microsoft-developed and vetted packages as much as we can.

It is a question of trust, and personally, I lean more to the latter.

That's why I write as much as I can myself, instead of using some 3-rd party solution.

And occasionally, I publish on Nuget things I found useful such as my data-access library Norm.

However, it's kind of hard to expect other people to have the same level of trust that I have for the code that I wrote - for some 3-rd party code. If you know what I mean.

That's where, in my opinion, Source Links technology comes into play.

It basically, lets you use some 3-rd party library and "Step into" the source code with your debugger - same as if that library is a normal part of your project as any other source code.

See more info on this page.

And, of course, that 3-rd party library needs to be open-source and has to have the Source Links feature enabled and publish along with the package.

Norm has Source Links included and here is how you can use it with the Visual Studio:

First of all - Source Links are not part of the project settings in the current version, so it needs to be enabled in Visual Studio Settings.

That is something that will be fixed in the future but for now, you'll have to go to Tools -> Options -> Debugging -> Symbols and enable NuGet.org Symbol Server option:

Alt Text

The next thing that will happen is a warning:

Alt Text

It just warns that this option enables source links for all packages in your project.

When you start the debugging session, the debugger will have to first download source code for all packages that you are using in your project (usually from GitHub), and that might take a while since the entire .NET is now open-sourced on GitHub with the source links.

That can seriously hurt the performances of your debugger, but only the first time.

If you want to have an option that you can step into with your debugger anywhere in .NET, that is something you might want to do, but you'll have to wait for the download first. Options window gives you fine control over the source links cache:

Alt Text

But if you don't want to download the source code for everything, you can specify modules that you want to include or exclude:

Alt Text

To specify that you want to set into with debugger into Norm only, just select Load specific modules, click on Specify included modules and enter Norm.dll:

Alt Text

The download process in your debugger will be over very quickly since Norm is a tiny library.

So let's see how it works. Simple debugger test:

Alt Text

When you try to Step Into (F11) with your debugger, first you'll get a confirmation window:

Alt Text

And the next thing that will happen very quickly is that you can debug your 3-rd party library as if it was part of your project.

And you can debug anything, including packages like Norm.

Very cool.

Top comments (0)

🌚 Life is too short to browse without dark mode