Skip to content

VersionUtils.IsNetCore returns false in net 5.0, breaking LoadAssemblyInPsesLoadContext #1317

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

Closed
SeeminglyScience opened this issue Jun 27, 2020 · 3 comments · Fixed by #1318
Labels

Comments

@SeeminglyScience
Copy link
Collaborator

The check for .NET core is implemented as this:

public static bool IsNetCore { get; } = RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.Ordinal);

But in .NET 5.0 the framework description no longer includes the word "Core". For example, in pwsh 7.1 preview 3, this is the framework description:

.NET 5.0.0-preview.4.20251.6

This makes EditorExtensionServiceProvider.LoadAssemblyInPsesLoadContext load the specified assembly in the default ALC, breaking ESCS:

public Assembly LoadAssemblyInPsesLoadContext(string assemblyPath)
{
        if (!VersionUtils.IsNetCore)
        {
                return Assembly.LoadFrom(assemblyPath);
        }
        return EditorExtensionServiceProvider.LoadAssemblyInPsesAlc(assemblyPath);
}
@ghost ghost added the Needs: Triage Maintainer attention needed! label Jun 27, 2020
@TylerLeonhardt
Copy link
Member

I always thought that check was suspicious...

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 27, 2020
@TylerLeonhardt
Copy link
Member

Looks like Platform.IsCoreCLR wasn't introduced until PowerShell Core... so... what about the negative check?:

!RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.Ordinal);

@TylerLeonhardt TylerLeonhardt added Area-Startup Issue-Bug A bug to squash. and removed Needs: Maintainer Attention Maintainer attention needed! Needs: Triage Maintainer attention needed! labels Jun 30, 2020
@ghost ghost added the Status: In PR label Jun 30, 2020
@TylerLeonhardt
Copy link
Member

PR out for this one with a move of our tests to PS7 and PS7.1 :)

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jun 30, 2020
@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Jun 30, 2020
@ghost ghost added Status: Fixed and removed Status: In PR labels Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants