dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.82k stars 773 forks source link

`ContinuousIntegrationBuild` breaks `__SOURCE_DIRECTORY__` #17288

Closed MangelMaxime closed 2 weeks ago

MangelMaxime commented 3 weeks ago

Hello,

having ContinuousIntegrationBuild set to true breaks __SOURCE_DIRECTORY__ .

Repro steps

Provide the steps required to reproduce the problem:

  1. Create a folder Minimal and inside it:

  2. Create Main.fs with

    printfn "%A" __SOURCE_DIRECTORY__
  3. Create Repro.fsproj with

    <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
            <OutputType>Exe</OutputType>
            <TargetFramework>net8.0</TargetFramework>
            <GenerateDocumentationFile>true</GenerateDocumentationFile>
            <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
        </PropertyGroup>
        <ItemGroup>
            <Compile Include="Main.fs" />
        </ItemGroup>
    </Project>
  4. Run dotnet run and see the reported path be something like /_//Minimal"

If you remove ContinuousIntegrationBuild then the reported path is correct.

If possible attach a zip file with the repro case. This often makes it easier for others to reproduce. The zip file should ideally represent the situation just before the call/step that is problematic.

Reproduction.zip

Expected behavior

Should report the absolute path even if ContinuousIntegrationBuild is set

Actual behavior

Report /_/ instead of the actual absolute path

Known workarounds

None

Related information

Provide any related information (optional):

baronfel commented 3 weeks ago

This is just a side effect of the way SourceMaps are written to PDBs and stuff - IIRC changing this would break PDBs, tooling just has to be aware of this and adjust for it. We've had to do it in Ionide, VS handles it, etc. IIRC this comes mostly from the pathmap concept, and it something that is required to be compatible with other tooling.

MangelMaxime commented 3 weeks ago

I indeed read something about pathmap on this issue https://github.com/dotnet/fsharp/issues/9379

I am not sure if there something to fix or not.

This bug is not too impactful in my situation, as it surfaced because I tried to use EasyBuild.FileSystemProvider in a build project (similar to a MakeFile). So I could disable ContinuousIntegrationBuild just for the Build.fsproj if needed.

abonie commented 2 weeks ago

We are going to close this, as it is not clear how to resolve this issue. If anyone has a specific idea how solve this, feel free to suggest it as a feature improvement for compiler