title: Debugging .net core 3.1 library code published on github private nuget repository is broken?
body: <p>In the last few days I've battled against an issue with debugging nuget packages that I still wasn't able to solve the way I want.</p>
  <p><strong>All this has been tested with visual studio 2022, updated to the latest version available.</strong></p>
  <p><strong>We have a .NET 3.1 library published on github (private package).
  We consume such library in many .NET 3.1 WebAPI backends that we develop.
  We need to be able to debug such library.</strong>
  GitHUB doesn't seem to support symbol servers at the moment, so I thought we had these <strong>2 possibilities</strong>:</p>
  <ol>
  <li><p><strong>embed the pdb in the dll: this seemed the most straightforward solution</strong> and was the first I tried. By doing so on the core library, when we import that in a .NET webapi project and inspect the &quot;modules&quot; window, we can see that <strong>symbols for the dll have been loaded correctly</strong>; symbol file column reads: &quot;OurLibrary.dll (embedded)&quot;</p>
  </li>
  <li><p><strong>include the pdb in the nupkg and then add a piece of code</strong> (found here <a href="https://github.com/dotnet/sdk/issues/1458#issuecomment-420456386" rel="nofollow noreferrer">https://github.com/dotnet/sdk/issues/1458#issuecomment-420456386</a>) <strong>in the .csproj of consuming .NET webapi project that ensures that the dll pdb, contained in the nuget package, is copied to the bin folder</strong>. Also in this case, inspecting the modules window, <strong>it looks that the symbols have been loaded from metadata</strong> (which I guess is the pdb file itself).</p>
  </li>
  </ol>
  <p><strong>STILL</strong>, in both cases, <strong>if the project is running</strong>, when I try to set a breakpoint in the Startup.cs file of the consuming WebAPI project, and <strong>step into an IServiceCollection extension method, which is defined in the library</strong>, I'm able to do so, but <strong>many symbols used in that file</strong> (referring to <strong>PUBLIC types</strong> defined in the library, <strong>or from the framework itself</strong>) <strong>are white, and I can't explore them</strong> by doing &quot;go to definintion&quot;.
  Instead, if I try to peek at the source code of the extension method mentioned before, <strong>when the project is not running, I'm able to peek at code by doing &quot;go to definition&quot; without issues</strong>. So, I set a breakpoint..</p>
  <p><a href="https://i.stack.imgur.com/5rOqX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5rOqX.png" alt="enter image description here" /></a></p>
  <p>Then, when I launch the project:</p>
  <p><a href="https://i.stack.imgur.com/muRTN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/muRTN.png" alt="enter image description here" /></a></p>
  <p>you can see that it's a different &quot;SessionFactory&quot; file, and all the symbols have become white. <strong>If I try to go back to the original file</strong> (with all the types correctly resolved by intellisense), <strong>and set a breakpoint inside it, visual studio automatically switches to the other file</strong> (with &quot;broken&quot; intellisense) and sets the breakpoint there, which is very frustrating..</p>
  <p>At the moment the only solution that really behaves the way I want requires me to remove the library nuget package from the project and reference the library as an &quot;Existing project&quot; inside the solution. By doing so everything works perfectly (of course, now library source code is part of the project) but of course seems wrong / time consuming / error prone.</p>
  <p>Somebody is able to shed some light on what is going on? Thanks</p>
  <p><strong>EDIT: FURTHER DETAILS FOR USER @Transformer</strong></p>
  <p>I tried your suggestion to include the supplied code in .csproj of both the library and the consuming application:</p>
  <p>By doing so in the library .csproj, it contains these settings related to PDB generation, in a property group:</p>
  <pre><code>&lt;EmbedAllSources&gt;true&lt;/EmbedAllSources&gt;
  &lt;DebugSymbols&gt;true&lt;/DebugSymbols&gt;
  &lt;DebugType&gt;portable&lt;/DebugType&gt;
  &lt;AllowedReferenceRelatedFileExtensions&gt;.pdb&lt;/AllowedReferenceRelatedFileExtensions&gt;
  &lt;GeneratePackageOnBuild&gt;True&lt;/GeneratePackageOnBuild&gt;
  </code></pre>
  <p>It also includes this, outside of the property group:</p>
  <pre><code>&lt;Target Name=&quot;AddReferenceRelatedPathsToCopyLocal&quot; AfterTargets=&quot;ResolveAssemblyReferences&quot;&gt;
  &lt;ItemGroup&gt;
  &lt;ReferenceCopyLocalPaths Include=&quot;@(_ReferenceRelatedPaths)&quot; /&gt;
  &lt;/ItemGroup&gt;
  &lt;/Target&gt;
  </code></pre>
  <p>Unfortunately, by doing so, the pdb doesn't seem to be included in the nupkg. Instead, if I add the following (a setting I've already found in the past):</p>
  <pre><code>&lt;AllowedOutputExtensionsInPackageBuildOutputFolder&gt;$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb&lt;/AllowedOutputExtensionsInPackageBuildOutputFolder&gt;
  </code></pre>
  <p>then the pdb is included in nupkg, but still, I experience the same debugging problem in the consuming library, even if I add the code you supplied to the consuming library as well...any other idea?</p>
  <p>Thanks a lot for your kind help</p>