Skip to content

Fix missed .NET 4.6.2 code #1768

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

Merged
merged 1 commit into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ PowerShellVersion = '5.1'

# Minimum version of Microsoft .NET Framework required by this module
# NOTE: We check this later, so that the error message is communicated properly to the user
# DotNetFrameworkVersion = '4.6.1'
# DotNetFrameworkVersion = '4.6.2'

# Minimum version of the common language runtime (CLR) required by this module
# CLRVersion = ''
Expand Down Expand Up @@ -129,4 +129,3 @@ PrivateData = @{
# DefaultCommandPrefix = ''

}

9 changes: 5 additions & 4 deletions src/PowerShellEditorServices.Hosting/EditorServicesLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ namespace Microsoft.PowerShell.EditorServices.Hosting
public sealed class EditorServicesLoader : IDisposable
{
#if !CoreCLR
private const int Net461Version = 394254;
// See https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
private const int Net462Version = 394802;

private static readonly string s_psesBaseDirPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
#endif
Expand Down Expand Up @@ -242,7 +243,7 @@ private static void LoadEditorServices() =>
#if !CoreCLR
private void CheckNetFxVersion()
{
_logger.Log(PsesLogLevel.Diagnostic, "Checking that .NET Framework version is at least 4.6.1");
_logger.Log(PsesLogLevel.Diagnostic, "Checking that .NET Framework version is at least 4.6.2");
using RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full");
object netFxValue = key?.GetValue("Release");
if (netFxValue == null || netFxValue is not int netFxVersion)
Expand All @@ -252,9 +253,9 @@ private void CheckNetFxVersion()

_logger.Log(PsesLogLevel.Verbose, $".NET registry version: {netFxVersion}");

if (netFxVersion < Net461Version)
if (netFxVersion < Net462Version)
{
_logger.Log(PsesLogLevel.Warning, $".NET Framework version {netFxVersion} lower than .NET 4.6.1. This runtime is not supported and you may experience errors. Please update your .NET runtime version.");
_logger.Log(PsesLogLevel.Warning, $".NET Framework version {netFxVersion} lower than .NET 4.6.2. This runtime is not supported and you may experience errors. Please update your .NET runtime version.");
}
}
#endif
Expand Down