ctaggart / SourceLink

Source Code On Demand
MIT License
356 stars 55 forks source link

dotnet coreclr has source link enabled! #363

Closed ctaggart closed 5 years ago

ctaggart commented 6 years ago

This is just awesome!

image

image

ctaggart commented 6 years ago

I tweeted this and people wanted more details for reproducing it. If I create a new F# Console App and make this my Program.fs

open System

[<EntryPoint>]
let main argv =
    let txt = IO.File.ReadAllText "version.txt"
    printfn "%s" txt
    0

The .fsproj is just a normal netcoreapp2.1.

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <RootNamespace>SourceLinkTest._15._8</RootNamespace>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Program.fs" />
  </ItemGroup>

</Project>

When it breaks, it has download and opened this file: C:\Users\taggac\AppData\Local\SourceServer\b10415eb2a144607e44abde47868668ad70b9b7cb26b993e32e7bc8fce84d98e\src\mscorlib\shared\System\IO\FileStream.Windows.cs

As seen in this screenshot:

image

deselect Enable Just My Code

The only think I changed in Debugging General settings to make this work I believe. image

Microsoft Symbol Servers

I believe these are all the default settings, but let me know if they are not. The symbols (pdb files) are downloaded from the Microsoft Symbol Servers and those pdb files have source link enabled.

image

ctaggart commented 6 years ago

I was able to step into System.Console.WriteLine just fine.

open System

[<EntryPoint>]
let main argv =
    Console.WriteLine "hello"
    0

Debug > Windows > Modules

Open up the Modules window in Visual Studio to see what symbols files are beings used.

image

It has source link enabled:

PS C:\Users\taggac\Documents> sourcelink print-json "C:\Users\taggac\AppData\Local\Temp\SymbolCache\System.Console.pdb\3C1B3B7C2E5C4DBDBACB5DD4BA90CD67ffffffff\System.Console.pdb"{"documents": { "E:\A\_work\20\s\corefx\" : "https://raw.githubusercontent.com/dotnet/corefx/d4541b21dcb0cb15c5ec49c38354bde46e3eaea4/" }}

ctaggart commented 5 years ago

I should have blogged about this...