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
{{ message }}
Repository navigation
Signature data embedded in executable contains absolute source file path #5213
The FSharpSignatureData resource embedded in the assembly contains absolute paths to the source files. This could include a user's real name etc.
I know this info is in the pdb, but shipping that with an executable is optional.
Executables produced from C# compiler don't contain file paths
Repro steps
Provide the steps required to reproduce the problem
Create a simple test.fs containing, say, let main argv = 1
fsc test.fs
strings test.exe
observe the full path to test.fs
Expected behavior
No source paths in the exe
Actual behavior
Absolute paths are embedded in the FSharpSignatureData resource
Known workarounds
Provide a description of any known workarounds.
Related information
Provide any related information
Windows
Microsoft (R) F# Compiler version 10.1.0 for F# 4.1
Before we just set this to "null", I should add that these file names are utilised by the F# IDE Tools to allow goto-definition and other things to work when
in-memory cross-project references are off and
you're referencing DLL components compiled on your machine.
This means go-to-definition will start failing for these cases if the file name information is just removed.
Alternatives might be
add a compiler option to suppress the generation of this information
add a compiler option to opt-in to include this information which is set when compiling from visual studio, or only set for Debug code
Seems like the right call to me. Though we'll also want to make sure this doesn't negatively affect other editors (@auduchinok / @Krzysztof-Cieslak / @nosami FYI)
I think it would be really odd if GTD only worked across compiled assembly boundaries for Debug mode.... No other design-time tooling depends on this like this....
Hmmm. Well I think that from a tooling perspective there's no issue in having this info. What I think I'd prefer is a way to specify a default where this info is not present when building, and have things like design-time builds kick with that feature turned on.
For a file test.cs, containing class test { public static int Main(string[] args) { return 1; } }
Compile with csc test.cs
Opening test.exe in the binary editor shows no pathnames.
yes, F# is a little bit worse. C# only embeds the absolute path if you generate a pdb, F# does it always.
You can try it with -pdb, then you should also see a path in C#. (-pdb is the default for a csproj)
I see value in having a way to suppress this (mostly for deterministic builds), but I don't think it should be enabled by default (even in release) if tooling suffers.
@saul I think F# should do deterministic paths by default when compiling with pdb, like C#. Is PathMap implementation the first step towards doing that or, should it be a native compiler feature?
Activity
dsyme commentedon Jun 19, 2018
I believe this is the only place where the file names are stored:
Before we just set this to "null", I should add that these file names are utilised by the F# IDE Tools to allow goto-definition and other things to work when
This means go-to-definition will start failing for these cases if the file name information is just removed.
Alternatives might be
cartermp commentedon Jun 19, 2018
Seems like the right call to me. Though we'll also want to make sure this doesn't negatively affect other editors (@auduchinok / @Krzysztof-Cieslak / @nosami FYI)
dsyme commentedon Jun 19, 2018
I think it would be really odd if GTD only worked across compiled assembly boundaries for Debug mode.... No other design-time tooling depends on this like this....
I think it would.
nosami commentedon Jun 19, 2018
VSMac can't turn off in-memory cross-project references. I would like to add this feature soon though.
cartermp commentedon Jun 19, 2018
Hmmm. Well I think that from a tooling perspective there's no issue in having this info. What I think I'd prefer is a way to specify a default where this info is not present when building, and have things like design-time builds kick with that feature turned on.
cartermp commentedon Jun 19, 2018
Here's what should happen:
I've labeled this as
Urgency-Soonfor now, but this is arguablyUrgency-Now.0x53A commentedon Jun 20, 2018
Are you sure the c# compiler doesn't embed any absolute paths?
As far as I know the exe contains an absolute path to the pdb, unless you specifically set a few flags.
Edit: this is built with VS2017, C# dll, all options the default ones:
marklam commentedon Jun 20, 2018
For a file
test.cs, containingclass test { public static int Main(string[] args) { return 1; } }Compile with
csc test.csOpening
test.exein the binary editor shows no pathnames.0x53A commentedon Jun 20, 2018
yes, F# is a little bit worse. C# only embeds the absolute path if you generate a pdb, F# does it always.
You can try it with -pdb, then you should also see a path in C#. (
-pdbis the default for a csproj)I see value in having a way to suppress this (mostly for deterministic builds), but I don't think it should be enabled by default (even in release) if tooling suffers.
Edit:
C# allows you to map paths with -pathmap.
I edited my csproj and added
<PathMap>C:\temp\KoalaTest=/</PathMap>.Result:
So instead of blindly and in a hurry nulling out the value, please consider implementing the proper c# solution
saul commentedon Oct 18, 2018
Linking #3812
NinoFloris commentedon Dec 3, 2018
@saul I think F# should do deterministic paths by default when compiling with pdb, like C#. Is PathMap implementation the first step towards doing that or, should it be a native compiler feature?
7sharp9 commentedon Dec 3, 2018
I just looked in a release build and found this and others:
NinoFloris commentedon Dec 3, 2018
Yeah it's everywhere in F# ecosystem, taskbuilder, saturn, giraffe all have (fun localized) user paths in there.
cartermp commentedon May 29, 2019
Re-opening as this is not resolved in VS