You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal Azure/AAD.fs#1 is to enable best practices by enabling Source Link and creating deterministic nuget packages. To have deterministic nuget packages, the assemblies & the pdb files must be deterministic. Following @clairernovotny's instructions, but it is not working for fsharp projects Azure/AAD.fs#3. The MSBuild log shows fsc is being passed --deterministic+, but the pdb file looks like:
(NuGet Package Explorer is just checking for a source path like /_/)
What happens if you use PathMap in the project file? Perhaps the F# targets just need to get updated to do that by default, since I'm pretty sure they don't
Using the example project, I see the SourceRoot mapping logic which is in this file on my laptop:
"C:\Program Files\dotnet\sdk\3.1.300\Roslyn\Microsoft.Managed.Core.targets"
Results in this csc option being passed in:
That's because PathMap is csc parameter. The SourceRoot items themselves need to be updated like so in order to be picked up by Source Link.
Oh, got it. I see SourceRoot is what Source Link uses. It is just passing --pathmap to the compilers based on it. I'm currently wondering if there is a way to include Roslyn\Microsoft.Managed.Core.targets and run the required targets with the current sdk.
Last time I tried, I could not debug into source-linked F# DLLs in VS. Getting source linked debugging working is high on my priority list. I searched and there is no open issue for this specifically.
@clairernovotny The work would be in msbuild Common targets, not in Roslyn.
@ctaggart I don't think you should include Roslyn\Microsoft.Managed.Core.targets in F# targets as it has logic that is Roslyn-specific. You could copy the targets and task that perform the source path mapping to F# targets.
This is possibly a duplicate of #8883, what do you think? Also, is there any chance of the targets getting moved in time for .Net 5/F# 5.0? If not, does F# want to embed the task/targets to enable this before that time?
Activity
clairernovotny commentedon Jun 3, 2020
The
/_/part comes fromContinousIntegrationBuildset to true, which should only be done on CI builds since local debugging won't work with that set.cartermp commentedon Jun 3, 2020
What happens if you use PathMap in the project file? Perhaps the F# targets just need to get updated to do that by default, since I'm pretty sure they don't
<PathMap>C:\doot=/</PathMap>clairernovotny commentedon Jun 3, 2020
I'm not following?
ctaggart commentedon Jun 3, 2020
@clairernovotny, yes,
ContinousIntegrationBuildis being set. That makes it so--deterministic+is passed tofsc. Based on the docs at https://github.com/dotnet/sourcelink/tree/master/docs#deterministicsourcepaths, I've also tried hardcoding all of these options without luck:clairernovotny commentedon Jun 3, 2020
@tmat?
ctaggart commentedon Jun 3, 2020
@cartermp, thanks for the
PathMapsuggestion. I tried various options, but none worked. I tried each of these:And I could see each option being passed to
fsc, such as--pathmap:C:\Users\=/for the lat one. fsc says that it is a valid option:It just does not have an impact on the produced sourcelink json.
tmat commentedon Jun 3, 2020
F# compiler msbuild targets might be missing SourceRoot mapping logic:
https://github.com/dotnet/roslyn/blob/master/src/Compilers/Core/MSBuildTask/Microsoft.Managed.Core.targets#L143-L227
Besides that we will need F# to implement this feature as well at some point (for next level badge):
dotnet/roslyn#41395
ctaggart commentedon Jun 3, 2020
Using the example project, I see the SourceRoot mapping logic which is in this file on my laptop:
"C:\Program Files\dotnet\sdk\3.1.300\Roslyn\Microsoft.Managed.Core.targets"
Results in this csc option being passed in:
Based on that, I hardcoded this:
Which made it to
fscas option:but no impact on the produced sourcelink json. 😢
tmat commentedon Jun 3, 2020
That's because PathMap is csc parameter. The SourceRoot items themselves need to be updated like so in order to be picked up by Source Link.
tmat commentedon Jun 3, 2020
See this comment: https://github.com/dotnet/roslyn/blob/master/src/Compilers/Core/MSBuildTask/Microsoft.Managed.Core.targets#L158
tmat commentedon Jun 3, 2020
Perhaps we should move these targets down to the msbuild Common targets, so that all languages can benefit from a common path mapping implementaiton.
clairernovotny commentedon Jun 3, 2020
@tmat I agree as it's important that this functionality is available everywhere. Do you want to create the work item in Roslyn for it or should I?
ctaggart commentedon Jun 3, 2020
Oh, got it. I see SourceRoot is what Source Link uses. It is just passing
--pathmapto the compilers based on it. I'm currently wondering if there is a way to includeRoslyn\Microsoft.Managed.Core.targetsand run the required targets with the current sdk.jackfoxy commentedon Jun 3, 2020
Last time I tried, I could not debug into source-linked F# DLLs in VS. Getting source linked debugging working is high on my priority list. I searched and there is no open issue for this specifically.
tmat commentedon Jun 3, 2020
@clairernovotny The work would be in msbuild Common targets, not in Roslyn.
@ctaggart I don't think you should include
Roslyn\Microsoft.Managed.Core.targetsin F# targets as it has logic that is Roslyn-specific. You could copy the targets and task that perform the source path mapping to F# targets.baronfel commentedon Aug 1, 2020
This is possibly a duplicate of #8883, what do you think? Also, is there any chance of the targets getting moved in time for .Net 5/F# 5.0? If not, does F# want to embed the task/targets to enable this before that time?
cartermp commentedon Aug 2, 2020
Yes, good catch - this should be closed in favor of #8883
I think we should strive to re-use this in F# even if it means a little copypasta.