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

force roll forward when discovered .NET version is greater than FSAC TFM #1889

Merged
merged 2 commits into from
Jul 1, 2023

Conversation

baronfel
Copy link
Contributor

@baronfel baronfel commented Jun 30, 2023

WHAT

🤖 Generated by Copilot at e108e17

This pull request enhances the compatibility and reliability of the F# language service by improving the fsautocomplete.dll launching logic. It uses the TFMs of the dotnet SDK and the fsautocomplete.dll to determine the best roll-forward policy and arguments. It also refactors and cleans up some code.

🤖 Generated by Copilot at e108e17

fsautocomplete
finds and launches better now
with new sdkVersion

🛠️🚀🆕

WHY

When running against a .NET 8 SDK, we can use the net7.0 binaries, but we must roll forward to the more recent Runtime. This is because without this roll forward, if the system has 7.0 runtimes installed the .NET host will prefer using those binaries.

HOW

🤖 Generated by Copilot at e108e17

  • Rename runtimeVersion to sdkVersion to better reflect its purpose (link)
  • Modify probePathForTFMs to return TFM and path to fsautocomplete.dll for each TFM (link)
  • Annotate fsacPathForTfm with type signature of string * string (link)
  • Extract TFM from user-specified fsautocomplete.dll path if it ends with ".dll" (link)
  • Extract TFM from user-specified directory path if it does not have TFM folders (link)
  • Refactor discoverDotnetArgs to simplify logic of finding SDK version, FSAC TFM and path, and roll-forward arguments and environment variables (link)
  • Use triple-quoted string literal for printing fsautocomplete.dll path in spawnNetCore (link)

Comment on lines 766 to 768
let shouldApplyImplicitRollForward =
not (hasUserFxVersion || hasUserRollForward)
&& sdkTfm <> fsacTfm // if the SDK doesn't match one of our FSAC TFMs, then we're in compat mode
Copy link
Contributor Author

Choose a reason for hiding this comment

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

core of the change is here - if the derived 'default' TFM of the SDK in use is not the TFM of the version of FSAC that we just chose (e.g. net8.0 on a 8.0.100-preview SDK with a net7.0 TFM FSAC binary), then we must apply rollforward flags to force the runtime to choose 8.0 bits. otherwise on a system with 7.0 bits installed we'll use those.

Comment on lines 774 to 775
[ if shouldApplyImplicitRollForward then
"DOTNET_ROLL_FORWARD", box "LatestMajor"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

pertinent change 1

Comment on lines 776 to 780
match sdkVersion.prerelease with
| null -> ()
| pres when pres.Count > 0 ->
"DOTNET_ROLL_FORWARD_TO_PRERELEASE", box "true"
| _ -> () ]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if the sdk in use is a preview we must apply another flag to let the runtime float forward to those previews

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