Skip to content

Fix URI format exception in relative path computation#244

Merged
TheAngryByrd merged 2 commits into
ionide:mainfrom
Smaug123:fix-uri-format-exception
Feb 28, 2026
Merged

Fix URI format exception in relative path computation#244
TheAngryByrd merged 2 commits into
ionide:mainfrom
Smaug123:fix-uri-format-exception

Conversation

@Smaug123

Copy link
Copy Markdown
Contributor

Originally observed in FSharp.Analyzers.SDK:

> dotnet fsdocs build --projects
src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.fsproj
src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsproj
--properties Configuration=Release --eval --clean --strict
cracking projects...
  skipping project 'FSharp.Analyzers.SDK.fsproj' because an error occurred while cracking it:
System.UriFormatException: Invalid URI: The format of the URI could not be determined.
   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions&
creationOptions)
   at System.Uri..ctor(String uriString)
   at Ionide.ProjInfo.VisualTree.relativePathOf(String fromPath, String toPath) in
/_//src/Ionide.ProjInfo/VisualTree.fs:line 23
   at Ionide.ProjInfo.VisualTree.visualPathVSBehaviour(String projPath, String filePath) in
/_//src/Ionide.ProjInfo/VisualTree.fs:line 33
   at Ionide.ProjInfo.VisualTree.getVisualPath(FSharpOption`1 linkMetadata, FSharpOption`1
fullpathMetadata, String identity, String projPath) in /_//src/Ionide.ProjInfo/VisualTree.fs:line 60
   at Ionide.ProjInfo.VisualTree.getCompileProjectItem(FSharpList`1 projItems, String projPath, String
sourceFile) in /_//src/Ionide.ProjInfo/VisualTree.fs:line 82
   at Ionide.ProjInfo.ProjectLoader.compileItems@752.Invoke(String sourceFile)
   at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in
D:\a\_work\1\s\src\FSharp.Core\local.fs:line 245
   at Microsoft.FSharp.Collections.ListModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 list)
in D:\a\_work\1\s\src\FSharp.Core\list.fs:line 97
   at Ionide.ProjInfo.ProjectLoader.mapToProject(String path, IEnumerable`1 compilerArgs, IEnumerable`1
 p2p, IEnumerable`1 compile, IEnumerable`1 nugetRefs, ProjectSdkInfo sdkInfo, IEnumerable`1 props,
IEnumerable`1 customProps) in /_//src/Ionide.ProjInfo/Library.fs:line 750
   at Ionide.ProjInfo.ProjectLoader.getLoadedProjectInfo(String path, FSharpList`1 customProperties,
LoadedProject project) in /_//src/Ionide.ProjInfo/Library.fs:line 831
   at Ionide.ProjInfo.ProjectLoader.getProjectInfo(String path, FSharpList`1 globalProperties,
BinaryLogGeneration binaryLogs, FSharpList`1 customProperties) in
/_//src/Ionide.ProjInfo/Library.fs:line 845
   at fsdocs.Crack.crackProjectFileAndIncludeTargetFrameworks[a](a _slnDir, FSharpList`1
extraMsbuildProperties, String projectFile) in
/home/runner/work/FSharp.Formatting/FSharp.Formatting/src/fsdocs-tool/ProjectCracker.fs:line 290
   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 379
   at fsdocs.Crack.projectInfos@484.Invoke(String p) in
/home/runner/work/FSharp.Formatting/FSharp.Formatting/src/fsdocs-tool/ProjectCracker.fs:line 486
Project cracking failed and --strict is on, exiting

The new test at line 2521 fails while the bug exists.

Path.GetRelativePath is in netstandard2.1; ProjInfo targets net8.0 at minimum.

Tests generated by Claude; if you like, I can cut them down to just the one that demonstrates the bug this PR fixes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Smaug123 Smaug123 changed the title Fix UriFormatException Fix URI format exception in relative path computation Feb 28, 2026
@Smaug123 Smaug123 force-pushed the fix-uri-format-exception branch from 5f22b7b to f50e288 Compare February 28, 2026 00:20
@Smaug123 Smaug123 force-pushed the fix-uri-format-exception branch from f50e288 to 7d79aea Compare February 28, 2026 00:36
@TheAngryByrd TheAngryByrd merged commit ddaff3b into ionide:main Feb 28, 2026
3 checks passed
@Smaug123 Smaug123 deleted the fix-uri-format-exception branch February 28, 2026 06:49
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

Successfully merging this pull request may close these issues.

2 participants