Skip to content

Update Proj-Info and solidify .net 6 support#825

Closed
baronfel wants to merge 19 commits intoionide:mainfrom
baronfel:udpate-proj-info
Closed

Update Proj-Info and solidify .net 6 support#825
baronfel wants to merge 19 commits intoionide:mainfrom
baronfel:udpate-proj-info

Conversation

@baronfel
Copy link
Copy Markdown
Contributor

No description provided.

//TODO: does the backgroundservice ever get config updates?
do
let allowedVersionRange =
let maxVersion = System.Environment.Version.Major + 1
Copy link
Copy Markdown
Contributor Author

@baronfel baronfel Aug 12, 2021

Choose a reason for hiding this comment

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

this version range will be 5.something on .net 5 and 6.something on .net 6, so we should ensure that the SDK/Runtime we load for FSX is within that bound.

This still floats to the highest in that bracket, but we can very easily allow some user customization here and just change the way we create the Range.

logQueueLength optsLogger (Log.setMessage "Getting NetCore options for script file {file}" >> Log.addContextDestructured "file" file)
let allFlags = Array.append [| "--targetprofile:netstandard" |] fsiAdditionalArguments
let! (opts, errors) = checker.GetProjectOptionsFromScript(UMX.untag file, source, assumeDotNetFramework = false, useSdkRefs = true, useFsiAuxLib = true, otherFlags = allFlags, userOpName = "getNetCoreScriptOptions")
optsLogger.trace (Log.setMessage "Got NetCore options {opts} for file {file} with errors {errors}" >> Log.addContextDestructured "file" file >> Log.addContextDestructured "opts" opts >> Log.addContextDestructured "errors" errors)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

might revert this now that I've debugged enough to have confidence in this code path again

let allModifications = replaceFrameworkRefs >> addLoadedFiles >> resolveRelativeFilePaths
return allModifications opts, errors
let modified = allModifications opts
optsLogger.trace (Log.setMessage "Replaced options to {opts}" >> Log.addContextDestructured "opts" opts)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

same here

sdkRoot <- Some directory
sdkVersion <- Environment.latest3xSdkVersion directory
runtimeVersion <- Environment.latest3xRuntimeVersion directory
//TODO(CH): should this range be user-assignable somehow?
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

similar point as in the background services: how should this be user-assignable?

"Ionide WorkspaceLoader", WorkspaceLoader.Create
// These are commented out because of https://github.com/ionide/proj-info/issues/109
// "MSBuild Project Graph WorkspaceLoader", WorkspaceLoaderViaProjectGraph.Create
"MSBuild Project Graph WorkspaceLoader", WorkspaceLoaderViaProjectGraph.Create
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

graph loader works in the new proj-info, so we can reenable it

@baronfel
Copy link
Copy Markdown
Contributor Author

Test hangs are due to a typeloadexception in the msbuild dlls. We're hitting a corner case in the test suite for some reason that not caught in a try-catch inside the loader loop in projinfo (which we should probably address in that library).

"Could not load type 'Microsoft.Build.Framework.IMetadataContainer' from assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'."

problem is:

  • we've got msbuild libs versions 16.x in this repo due to FCS at minimum (so we're bound to those?)
  • new projinfo version loads msbuild dlls from the sdk directory by setting an assemblyresolve handler (hell, old one did too so wtf is happening)
  • sdk msbuild dlls are version 15.1.x for sdk version 5.0.3xx
  • insert version mismatch here

Weirdly, the 6.0.1xx previews have the same assemblyversion.

@baronfel
Copy link
Copy Markdown
Contributor Author

baronfel commented Oct 27, 2021

Current status on this is that it works for .net 6 FSI scripts, but project loading has some kind of a hang - even on .net 5 now we start loading the project but it never completes. We need some additional logging/tracing here to have insight to what's happening in proj-info.

Once that's resolved things should start lighting back up, I expect tests to be as green as they were before this change. The next hurdle will be .net 6 testing. We may initially do manual testing on .net 6 SDKs just to get it out of the door, but we'll need .net capable FAKE runners or a pivot to .net 6 build projects in order to run the tests in a .net 6 target to keep that verification active in the future.

@baronfel
Copy link
Copy Markdown
Contributor Author

@Krzysztof-Cieslak did some additional debugging and for some reason (for local usage) project cracking is loading an 15.x msbuild dll, which of course isn't resolvable in the SDK directory we're pinned to because those are 16.x. Where does this come from? no one knows.

FSharpLint and FCS itself have 16.x msbuild dependencies, but this 15.x dependency can't be found easily by either of us. Might need to dip into binlogs to trace where it's coming from.

@baronfel
Copy link
Copy Markdown
Contributor Author

baronfel commented Nov 2, 2021

closing in favor of #846

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