Skip to content

[Repo Assist] Update Ionide.ProjInfo to 0.74.2, fix URI format exception#1056

Draft
github-actions[bot] wants to merge 6 commits intomainfrom
repo-assist/fix-issue-1054-update-projinfo-176556ef32054cf4
Draft

[Repo Assist] Update Ionide.ProjInfo to 0.74.2, fix URI format exception#1056
github-actions[bot] wants to merge 6 commits intomainfrom
repo-assist/fix-issue-1054-update-projinfo-176556ef32054cf4

Conversation

@github-actions
Copy link
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Closes #1054

What Changed

  • Updated Ionide.ProjInfo 0.62.0 → 0.74.2 in Directory.Packages.props
  • Removed Ionide.ProjInfo.Sln package — its functionality was merged into the main Ionide.ProjInfo package at v0.70.0; no separate package exists for v0.70.0+
  • Migrated ProjectCracker.fs to the new WorkspaceLoader API:
    • Replaced the removed ProjectLoader.getProjectInfo call with WorkspaceLoader.Create(toolsPath, extraMsbuildProperties) + loader.LoadProjects([projectFile], customProperties, BinaryLogGeneration.Off)
    • Subscribe to loader.Notifications for WorkspaceProjectState.Failed to capture error messages
  • Fixed InspectSln.tryParseSln pattern: changed Ok(_, slnData)Ok slnData — the return type changed from Result(unit * SolutionData, exn) to Result(SolutionData, exn) in v0.74.x

Root Cause

The VisualTree.relativePathOf URI format exception (reported in #1054) was triggered by a code path in older Ionide.ProjInfo versions that handled file URIs. The v0.74.2 release fixes this upstream. This PR upgrades to that version and adapts the API calls accordingly.

Trade-offs

  • The new WorkspaceLoader API loads the project and reports errors asynchronously via Notifications. Errors are captured in a ConcurrentQueue before being matched against the existing CrackErrors type — no behaviour change for callers.
  • Ionide.ProjInfo.Sln provided solution-file parsing utilities; since these were merged into Ionide.ProjInfo itself, removing the separate package reference has no functional impact.

Test Status

dotnet build FSharp.Formatting.sln --configuration Release — succeeded, 0 warnings, 0 errors
dotnet test FSharp.Formatting.sln --configuration Release --no-build — 76 passed, 0 failed, 4 skipped
dotnet fantomas src/fsdocs-tool/ProjectCracker.fs — file already correctly formatted (unchanged)

Generated by Repo Assist for issue #1054

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@afb00b92a9514fee9a14c583f059a03d05738f70

- Update Ionide.ProjInfo from 0.62.0 to 0.74.2
- Remove Ionide.ProjInfo.Sln (merged into main package at v0.70.0)
- Migrate crackProjectFileAndIncludeTargetFrameworks to use
  WorkspaceLoader.Create + LoadProjects instead of the removed
  ProjectLoader.getProjectInfo API
- Fix InspectSln.tryParseSln pattern: Ok(_, slnData) -> Ok slnData
  (return type changed from Result<unit * SolutionData, exn> to
   Result<SolutionData, exn> in v0.74.x)

Fixes #1054

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Smaug123
Copy link

(Consider #1055 instead, which uses the helper function from proj-info. Or don't; I don't mind!)

@github-actions

This comment has been minimized.

@dsyme
Copy link
Contributor

dsyme commented Feb 28, 2026

@Smaug123 Trying to understand why your onw required the MSBuild package reference and this one doesn't seem to need to

@dsyme
Copy link
Contributor

dsyme commented Feb 28, 2026

/repo-assist Please take a close look at #1055 which uses the helper function from proj-info and see if you can fold that in. Also analyze if/why the MSBuild reference was necessary in that PR and if there's something missing from your PR or maybe it doesn't much matter either way. Report back here with a comment or update this PR if you're really sure.

…paceLoader

Adopt the simpler lower-level API from Ionide.ProjInfo (as in PR #1055):
- Replace WorkspaceLoader.Create + Notifications + LoadProjects with
  ProjectLoader.loadProject + ProjectLoader.getLoadedProjectInfo
- Add explicit Microsoft.Build reference (compile-time only, ExcludeAssets=runtime)
  since ProjectCollection is now directly instantiated in user code
- Fewer lines of code, no async notification subscription needed

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

Commit pushed: 1a2fef2

Generated by Repo Assist

@github-actions

This comment has been minimized.

| Ok loadedProject ->
match ProjectLoader.getLoadedProjectInfo projectFile customProperties loadedProject with
| Ok(ProjectLoader.LoadedProjectInfo.StandardProjectInfo projOptions) -> Ok projOptions
| Ok _ -> Error $"project '%s{projectFile}' is not a standard project"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should log at info/debug and ignore if something isn't a standard project. So this could become Ok None, and fix up the filtering.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we already have a "skipping" mechanism, so maybe just verify this doesn't stop processing other project.

@TheAngryByrd
Copy link
Contributor

cracking projects...
  skipping project 'FSharp.CodeFormat.Tests.fsproj' because an error occurred while cracking it: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

File name: 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at fsdocs.Crack.crackProjectFileAndIncludeTargetFrameworks[a](a _slnDir, IEnumerable`1 extraMsbuildProperties, String projectFile) in /home/runner/work/FSharp.Formatting/FSharp.Formatting/src/fsdocs-tool/ProjectCracker.fs:line 250
   at fsdocs.Crack.crackProjectFile[a](a slnDir, FSharpList`1 extraMsbuildProperties, String file) in /home/runner/work/FSharp.Formatting/FSharp.Formatting/src/fsdocs-tool/ProjectCracker.fs:line 411
   at fsdocs.Crack.projectInfos@509.Invoke(String p) in /home/runner/work/FSharp.Formatting/FSharp.Formatting/src/fsdocs-tool/ProjectCracker.fs:line 511
Project cracking failed and --strict is on, exiting
Exit code is not indicating as successful.

This might require a @baronfel response

@dsyme
Copy link
Contributor

dsyme commented Feb 28, 2026

@TheAngryByrd From the analysis above it looks like it may be better for us to continue to use WorkspaceLoader and avoid the MSBuild dependency, what do you think?

@TheAngryByrd
Copy link
Contributor

Yeah I agree, the WorkspaceLoader is the interface to use.

@dsyme
Copy link
Contributor

dsyme commented Mar 1, 2026

/repo-assist Switch back to using WorkspaceLoader and address any review comments from @TheAngryByrd that are still applicable after that

- Replace ProjectLoader.loadProject + getLoadedProjectInfo with the
  WorkspaceLoader.Create + LoadProjects API (the correct interface)
- Remove Microsoft.Build package reference (no longer needed)
- When WorkspaceLoader returns 0 projects (non-standard project),
  log at info level and return Ok None instead of Error — projects are
  skipped gracefully without triggering the strict-mode error path
- Change crackProjectFile to return CrackedProjectInfo option so that
  callers can use Array.choose directly without wrapping in Some

Addresses @TheAngryByrd's review: non-standard projects now log and
skip rather than failing the whole build.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

github-actions bot commented Mar 1, 2026

Commit pushed: f5fb4f6

Generated by Repo Assist

@github-actions
Copy link
Contributor Author

github-actions bot commented Mar 1, 2026

🤖 This is an automated response from Repo Assist.

I've pushed a new commit that switches back to WorkspaceLoader and addresses @TheAngryByrd's review comment.

What changed

  • Reverted to WorkspaceLoader.Create + LoadProjects — removes the Microsoft.Build.Evaluation.ProjectCollection dependency entirely, eliminating the FileNotFoundException for Microsoft.Build, Version=14.0.0.0
  • Removed the Microsoft.Build package reference from fsdocs-tool.fsproj
  • Non-standard projects now skip gracefully (Ok None path): when WorkspaceLoader returns 0 results, the project is logged at info level and filtered out — it does not trigger the strict-mode error path or block other projects from loading
  • crackProjectFile now returns CrackedProjectInfo optionNone means "gracefully skipped"; Array.choose in crackProjects uses this directly

Addressing @TheAngryByrd's review

I think we should log at info/debug and ignore if something isn't a standard project. So this could become Ok None, and fix up the filtering.

Done — non-standard projects now log at info level and return None through the call chain, which Array.choose filters out without calling onError. Other projects in the solution continue processing normally.

Test Status

dotnet build FSharp.Formatting.sln --configuration Release — 0 warnings, 0 errors
dotnet test FSharp.Formatting.sln --configuration Release --no-build — 76 passed, 0 failed, 4 skipped
dotnet fantomas src/fsdocs-tool/ProjectCracker.fs --check — no formatting issues

Generated by Repo Assist for issue #1056

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@da02dddebe71d9a937665abdcd1f5214dab852a7

|> Seq.toList

match projects with
| projOptions :: _ -> Ok(Some projOptions)
Copy link
Contributor

@TheAngryByrd TheAngryByrd Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, we'll have to fix how we do API generation. A single project can return multiple results (for instance, you get a different result per TFM). Which could change the API documentation. We'll either have to have a TFM chooser like MSDN does or some other way to denote some APIs are only available per TFM.

Copy link
Contributor

@TheAngryByrd TheAngryByrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If CI works then I'd say lets go with this option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update ProjInfo to v0.74.2 to fix VisualTree.relativePathOf issue

3 participants