question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to Step Into Third Party Code

See original GitHub issue

Summary

Pdb generation works fine, but third party code can’t be stepped into.

System

Windows 10, VS 15.8.8.

Description

I’ve got a simple class library with the following csproj:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
        <PublishRepositoryUrl>true</PublishRepositoryUrl>
        <EmbedUntrackedSources>true</EmbedUntrackedSources>
        <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All" />
    </ItemGroup>

</Project>

This works fine. A valid pdb is included when i generate a package. I’ve tested the pdb with the SourceLink command line tool:

sourcelink test .\Test.AzurePipelines.pdb
sourcelink test passed: .\Test.AzurePipelines.pdb

sourcelink print-json .\Test.AzurePipelines.pdb
{"documents":{"C:\\Projects\\Test.AzurePipelines\\*":"https://raw.githubusercontent.com/JeremyTCD/Test.AzurePipelines/74d8b24ebde6ec0d9e38ad1355bafae1356da993/*"}}

sourcelink print-urls .\Test.AzurePipelines.pdb
178770449866fd131ae2150699c6b8a494e566ce sha1 csharp C:\Projects\Test.AzurePipelines\src\Test.AzurePipelines\Class1.cs
https://raw.githubusercontent.com/JeremyTCD/Test.AzurePipelines/74d8b24ebde6ec0d9e38ad1355bafae1356da993/src/Test.AzurePipelines/Class1.cs
d19483e16d67ae4da6e044d3fdeb35dd87480282 sha1 csharp C:\Users\Jeremy\AppData\Local\Temp\.NETStandard,Version=v2.0.AssemblyAttributes.cs
embedded

The urls have been checked manually and they work fine.

I’ve published the package to a local nuget feed:

dotnet pack -c Release
nuget push .\Test.AzurePipelines.2.0.0.nupkg -src "D://NugetLocalFeed"

And I’ve referenced it from a test console application with the following csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Test.AzurePipelines" Version="2.0.0" />
  </ItemGroup>

</Project>

I’ve disabled Just My Code and enabled Source Link Support: options

The pdb loads fine:

modules

The SourceLink command line tool indicates that the pdb in the image is valid.

Unfortunately, I still can’t step into my class library’s functions. F11 just steps over functions. Am I doing something wrong? I’ve gotten SourceLink to work before once, but it was using an older version of VS. Unfortunately I can’t rollback my VS version. Anyone else having trouble with VS 15.8.8 and SourceLink?

Edit: Doesn’t work on 15.9.0 Preview 4.0 either.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JeremyTCDcommented, Oct 27, 2018

After some clicking around, I think VS might be the problem. F11 does not work, but “Step Into Specific” from the context menu works:

stepinto

Whats happening in the gif:

  • Start debugging.
  • F11, skips right over line with ToLower invocation.
  • Ctrl+Shift+F10 to set next line back to the line with ToLower invocation.
  • Use “Step Into Specific” this time.
  • Popup for source download appears, source downloads successfully.
  • Steps into ToLower.

Not sure if my VS is just scuffed. If this is the case for everyone, might be a good idea to document that F11 doesn’t step into third party sources.

0reactions
chuckriescommented, Oct 30, 2018

Thanks for the follow up. It’s worth checking in the modules window to see what version of the coreclr runtime you are actually running on, as this is the version of the coreclr debugger you will be running with. Starting with 2.0, the shared framework/runtime is supposed to be forward compatible. That is, if you have only .NET Core 2.1 installed and you run a netcoreapp2.0 on the shared framework, it will happily run on the 2.1 runtime.

I believe in my testing I looked at coreclr versions 2.0.9 and 2.1.5 (or something).

This shouldn’t matter for net461, so I’m surprised you are not seeing those work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to step into 3rd party code using debugger
[Update] I was able to get the Find Source dialog up by the following method. Run to the break point , then select...
Read more >
Debugging Third-Party Code in Visual Studio - Yaakov's Blog
The secret here is to go to Debug > Windows > Modules, select the DLL that contains the code we want to step...
Read more >
Jupyter cell debugging does not support "step into" the ...
Jupyter cell debugging does not support "step into" the third party library code with "justmycode:false" in launch.json. Please fix it !
Read more >
Not Just My Code: How to debug third party libraries without ...
Step 1 — Generate symbols using decompiling tool dotPeek. When library is built in Visual Studio it's it's also supplied with *.PDB files...
Read more >
Debugging 3rd Party .NET Code without symbols in Visual ...
In this article we're going to do just that – We're going to see how to debug 3rd party library code in Visual...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found