How can I get Visual Studio to use Embedded Source code whilst debugging?

纵饮孤独 提交于 2020-02-19 09:38:41

问题


I have embedded the C# source code into a portable PDB file using the <EmbedAllSources> element in the csproj file, and I have embedded the pdb into the assembly using the <DebugType>embedded<DebugType> as described in Embedding C# sources in PDB with new csproj

My assembly looks like this:

<PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>    
    <EmbedAllSources>true</EmbedAllSources>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>embedded</DebugType>   
</PropertyGroup>

I can confirm that the pdb is type portable, and contains my source code:

According to the release notes for Visual Studio 15.5 the debugger should be able to use these files during debugging:

https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2017-relnotes-v15.5#EmbeddedSource

I'm using Visual Studio 2017 (version number 15.8.8)

However, when I F11 into the code from my assembly it asks for the sourcecode:

Whilst googling around there's a comment from ctaggart in the discussion https://github.com/ctaggart/SourceLink/issues/192 which says running sourcelink print-urls will print "embed" but mine doesn't, perhaps this is a hint:

Has anyone got this to work successfully? If so can you tell what I'm doing wrong?

来源:https://stackoverflow.com/questions/53176221/how-can-i-get-visual-studio-to-use-embedded-source-code-whilst-debugging

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!