FreeBSD FridayProgramming / DevelopmentWPF Databinding TutorialMy Posts

Welcome to my technology learning website. The goal of this site is to learn and retain as much information as possible. I consider this blog my knowledge base and hope that you both find and share knowledge here as well. Also for those wondering, Rhyous is pronounced ‘rī-əs. As in the words ‘Rye‘ and ‘us‘ compounded into a two syllable word.

Please take a moment to subscribe, or setup an RSS feed so you never miss a post.

Debugging Open Source dependencies included as NuGet packages

You may encounter the need to debug into a dependency that is NuGet package. If this NuGet package is proprietary, you need to contact the vendor. However, if the NuGet package is open source, perhaps on GitHub, then you have all the tools you need to debug into it. Debugging into an open source NuGet package is what this article is about.

We are going to use Rhyous.StringLibrary for this example. It is a simple open source project that provides some common extensions to strings. These are extensions that are often found duplicated in many different projects and sometimes multiple times in the same project.

Step 1 – Check out the Source

Check out the repo from GitHub. You need a Git client. If you don’t have one, you can use GitHub Desktop or the one that is included in the Windows install of Git.

  1. Check out the repository: 
    git fetch https://github.com/rhyous/StringLibrary.git 

Step 2 – Build the Solution

  1. Open the StringLibrary.sln in Visual Studio.
  2. Click Build.
  3. Go to the output directory and copy the dll and pdb files.

Step 3 – Copy the dll and pdb to your solution

If you go to your project that references the dll, find and highlight the reference and go to properties, you can see the full path to the referenced dll.

  1. Go to the solution folder of the project you are working on.
  2. Go to your project that references the dll.
  3. Under References, locate the dll.
  4. Go to Properties of the dll reference by pressing F4.
  5. Note the path to the dll.
  6. Go into the Packages directory.
  7. Find the folder for Rhyous.StringLibrary.
  8. Locate the dll folder. 
  9. Rename the existing rhyous.stringlibrary.dll to rhyous.stringlibrary.dll.orgininal.
  10. Copy the compiled dll and pdb from Step 2 to this folder.
  11. Clean and build your solution.

Step 4 – Add a breakpoint

You should now be able to step into the Rhyous.StringLibrary source from your project.

Note: If you have two instances of Visual Studio open, one for your project and one for Rhyous.StringLibrary project, you may think you put the break point in on the one with the SimplePluginLoader project. You don’t.  You don’t even need the Rhyous.StringLibrary project open, unless you need to make a change and recompile and recopy the dll and pdb to the packages directory.

  1. Debug your poject.
  2. Put a break point on the call to Rhyous.StringLibrary you would like to step into.
  3. Step into the call to Rhyous.StringLibrary. 
    Once you have stepped into the call, you should see it’s source.
    Continue stepping into or over or whatever you would like.
    Once you are in the source, you can add breakpoints.
     

Leave a Reply

How to post code in comments?