From f672a5119961a355952c0f39dd0c76daf87780c1 Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Mon, 8 Apr 2019 19:56:12 -0700 Subject: [PATCH 1/4] Add API for runtime CoreCLR check --- src/PowerShellEditorServices/Utility/Utils.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/PowerShellEditorServices/Utility/Utils.cs diff --git a/src/PowerShellEditorServices/Utility/Utils.cs b/src/PowerShellEditorServices/Utility/Utils.cs new file mode 100644 index 000000000..c86e5d145 --- /dev/null +++ b/src/PowerShellEditorServices/Utility/Utils.cs @@ -0,0 +1,21 @@ +#if CoreCLR +using System.Runtime.InteropServices; +#endif + +namespace Microsoft.PowerShell.EditorServices +{ + /// + /// General purpose common utilities to prevent reimplementation. + /// + internal static class Utils + { + /// + /// True if we are running on .NET Core, false otherwise. + /// +#if CoreCLR + public static bool IsNetCore { get; } = RuntimeInformation.FrameworkDescription.StartsWith(".NET Core"); +#else + public static bool IsNetCore { get; } = false; +#endif + } +} From 240c655def8098623dd869ea2f6460e1cf17a82b Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Mon, 8 Apr 2019 21:44:25 -0700 Subject: [PATCH 2/4] copyright --- src/PowerShellEditorServices/Utility/Utils.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PowerShellEditorServices/Utility/Utils.cs b/src/PowerShellEditorServices/Utility/Utils.cs index c86e5d145..b53b9d432 100644 --- a/src/PowerShellEditorServices/Utility/Utils.cs +++ b/src/PowerShellEditorServices/Utility/Utils.cs @@ -1,3 +1,8 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + #if CoreCLR using System.Runtime.InteropServices; #endif From 2f1ff4211b97a22ec67e69f12477b389c95caa0d Mon Sep 17 00:00:00 2001 From: Patrick Meinecke Date: Tue, 9 Apr 2019 09:20:32 -0700 Subject: [PATCH 3/4] Update src/PowerShellEditorServices/Utility/Utils.cs Co-Authored-By: rjmholt --- src/PowerShellEditorServices/Utility/Utils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PowerShellEditorServices/Utility/Utils.cs b/src/PowerShellEditorServices/Utility/Utils.cs index b53b9d432..c7cbc58d1 100644 --- a/src/PowerShellEditorServices/Utility/Utils.cs +++ b/src/PowerShellEditorServices/Utility/Utils.cs @@ -18,7 +18,7 @@ internal static class Utils /// True if we are running on .NET Core, false otherwise. /// #if CoreCLR - public static bool IsNetCore { get; } = RuntimeInformation.FrameworkDescription.StartsWith(".NET Core"); + public static bool IsNetCore { get; } = true; #else public static bool IsNetCore { get; } = false; #endif From ebbd1c6fd506f139ae2538f8bd36d014c64b82bd Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Tue, 9 Apr 2019 09:55:09 -0700 Subject: [PATCH 4/4] Update Utils.cs --- src/PowerShellEditorServices/Utility/Utils.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/PowerShellEditorServices/Utility/Utils.cs b/src/PowerShellEditorServices/Utility/Utils.cs index c7cbc58d1..2dc9d5021 100644 --- a/src/PowerShellEditorServices/Utility/Utils.cs +++ b/src/PowerShellEditorServices/Utility/Utils.cs @@ -3,10 +3,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -#if CoreCLR -using System.Runtime.InteropServices; -#endif - namespace Microsoft.PowerShell.EditorServices { ///