Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering non F# files in .fsproj crashes ionide #227

Open
pkese opened this issue Feb 23, 2025 · 2 comments
Open

Rendering non F# files in .fsproj crashes ionide #227

pkese opened this issue Feb 23, 2025 · 2 comments

Comments

@pkese
Copy link

pkese commented Feb 23, 2025

Describe the bug

I have a bit of scripting in my .fsproj file (to render some json-schemas from yaml written specs):

    <ItemGroup>
        <YamlFiles Include="assets/schema/**/*.yaml" />
        <JsonFiles Include="@(YamlFiles->'assets/schema/%(RelativeDir)%(Filename).json')" />
    </ItemGroup>
    <Target Name="GenerateJsonFromYaml" BeforeTargets="BeforeBuild" Inputs="@(YamlFiles)" Outputs="@(JsonFiles)">
        <Exec Command="dotnet fsi Yaml2Json.fsx @(YamlFiles, ' ')" />
    </Target>
    <ItemGroup>
        <None Include="assets/schema/**">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
    </ItemGroup>

dotnet restore and dotnet build handle this code prefectly fine (with expected results), but Ionide fails to load the project:
in the project list it shows "myproject.fsproj (loading...)" and then never loads the project.

If I remove the top two sections (the first ItemGroup and Target) then Ionide loads fine.

To Reproduce

Add something like the above to your .fsproj.
You can use something like cp/copy or simply touch insteady of my Yaml2Json.fsi (what the action does, probably doesn't matter anyway).

Environment (please complete the following information):

  • OS: Ubuntu 24.04
  • Ionide version: 7.25.2
  • VSCode version: 1.97.2
  • dotnet SDK version: 9.0.103
  • mono / .Net Framework version: N/A
@pkese
Copy link
Author

pkese commented Feb 23, 2025

This is the only meaningful log that I get from the VSCode's in developer tools console when trying to load a file from that project:

ERR Couldn't find /home/peter/work/oecd/observatory2/src/backend/ingest/O2Schema.Types.fs in LoadedProjects. Have the projects loaded yet or have you tried restoring your project/solution?: Error: Couldn't find /home/peter/work/oecd/observatory2/src/backend/ingest/O2Schema.Types.fs in LoadedProjects. Have the projects loaded yet or have you tried restoring your project/solution?

at handleResponse (/home/peter/.vscode/extensions/ionide.ionide-fsharp-7.25.2/webpack:/node_modules/vscode-jsonrpc/lib/common/connection.js:531:48)
at processMessageQueue (/home/peter/.vscode/extensions/ionide.ionide-fsharp-7.25.2/webpack:/node_modules/vscode-jsonrpc/lib/common/connection.js:327:17)
at Immediate. (/home/peter/.vscode/extensions/ionide.ionide-fsharp-7.25.2/webpack:/node_modules/vscode-jsonrpc/lib/common/connection.js:311:13)
at processImmediate (node:internal/timers:483:21)

@TheAngryByrd
Copy link
Member

TheAngryByrd commented Feb 23, 2025

To help diagnose this, you'll want to enable binlogs with the FSharp.generateBinlog setting

Image

It'll output into the .ionide/ folder. You can then use https://github.com/KirillOsenkov/MSBuildStructuredLog?tab=readme-ov-file#installing-the-avalonia-version-on-mac to investigate what it's failing on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants