Reputation: 1935
I am making a Nuget package and would like the devs that use it to be able to step through it during debug.
I've heard of "symbol packages" but from the little I know it seems complicated, both for me and for the user, as I would need to setup a symbol package and the user would need to configure a symbol server to use.
I was hoping I can just embed the debug symbols into the package using
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
in the project file, but when I published a test package with those and downloaded it from Nuget.org on another computer it does not work. The breakpoint I set in the package source is skipped and during debug it says The breakpoint will not currently be hit. A copy of Class1.cs was found in MyPackage.dll (embedded), but the current source code is different from the version built into MyPackage.dll (embedded)
which I have no idea why comes up.
How can I fix this?
Upvotes: 1
Views: 1340
Reputation: 1935
As often happens, I stumbled upon the answer shortly after posting, which I wish someone would bundle up with <DebugSymbols>
, as I don't think they work separately.
What I was missing was <EmbedAllSources>true</EmbedAllSources>
. This embeds the source code in the package and I don't think either of the two options "EmbedAllSources" and "DebugSymbols" works without the other.
It also seems <DebugSymbols>true</DebugSymbols>
is unneeded, as true
seems to be the default.
Anyone with more information, please feel free to add, correct and etc.
EDIT:
"Release" configuration ignores the "DebugSymbols" directive. So I don't know how you can embed debug symbols in "Release".
Upvotes: 3