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

getProjectInfo and loadProject don't seem to work now and aren't tested #122

Closed
dsyme opened this issue Nov 6, 2021 · 2 comments
Closed
Labels

Comments

@dsyme
Copy link
Contributor

dsyme commented Nov 6, 2021

FSharp.Formatting picked up a dependency on getProjectInfo (which uses loadProject), but they no longer seem to work.

I note these don't have tests in this repo so we should add those

The error I was getting was:

  skipping project 'FSharp.Formatting.Markdown.fsproj' ... error - The SDK 'Microsoft.NET.Sdk' specified could not be found.  

I think because they don't know toolsPath. Anyway I replaced getProjectInfo by this snippet I found in the test suites

        let loadProject (path: string) =
                let cwd = System.IO.Path.GetDirectoryName path |> System.IO.DirectoryInfo
                let toolsPath = Ionide.ProjInfo.Init.init cwd None
                let tfm = ProjectLoader.getTfm path (dict extraMsbuildProperties)
                let readingProps =
                    Ionide.ProjInfo.ProjectLoader.getGlobalProps path tfm extraMsbuildProperties
                    |> Seq.toList
                    |> List.map (fun (KeyValue(k,v)) -> (k,v))
                let loader = WorkspaceLoader.Create(toolsPath, readingProps)
                loader.LoadProjects([ path ], customProperties, BinaryLogGeneration.Off) 

That seemed to improve things though I now get another error:

  skipping project 'FSharp.Formatting.Markdown.fsproj' because an error occurred while cracking it: System.Exception: error - System.ArgumentException: The input sequence was empty. (Parameter 'source')
   at Microsoft.FSharp.Collections.SeqModule.Head[T](IEnumerable`1 source) in D:\a\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 1364
   at Ionide.ProjInfo.SdkDiscovery.versionAt(DirectoryInfo cwd, FileInfo dotnetBinaryPath) in D:\a\proj-info\proj-info\src\Ionide.ProjInfo\Library.fs:line 106
   at Ionide.ProjInfo.Init.init(DirectoryInfo workingDirectory, FSharpOption`1 dotnetExe) in D:\a\proj-info\proj-info\src\Ionide.ProjInfo\Library.fs:line 182
   at fsdocs.Crack.parseProject@196(FSharpList`1 extraMsbuildProperties, FSharpList`1 customProperties, String path) in E:\GitHub\dsyme\FSharp.Formatting\src\fsdocs-tool\ProjectCracker.fs:line 199
log -
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1439.Invoke(String message) in D:\a\_work\1\s\src\fsharp\FSharp.Core\printf.fs:line 1439
   at fsdocs.Crack.projectInfos@392.Invoke(String p) in E:\GitHub\dsyme\FSharp.Formatting\src\fsdocs-tool\ProjectCracker.fs:line 394```
@baronfel
Copy link
Collaborator

Closing this, as both mentioned functions are under test now for many different SDK bands in the test suite.

@dsyme
Copy link
Contributor Author

dsyme commented Sep 25, 2022

Thank you!!!!

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

No branches or pull requests

3 participants