diff --git a/eng/targets/Imports.targets b/eng/targets/Imports.targets index f1d6ee86ea9cb..d91c8cdc39726 100644 --- a/eng/targets/Imports.targets +++ b/eng/targets/Imports.targets @@ -404,4 +404,10 @@ + + + <_MicrosoftWindowsDesktopSdkImported>false + + diff --git a/global.json b/global.json index a19643d24f773..aaa923904fb3c 100644 --- a/global.json +++ b/global.json @@ -1,11 +1,11 @@ { "sdk": { - "version": "5.0.100-preview.8.20417.9", + "version": "5.0.100-rc.1.20452.10", "allowPrerelease": true, "rollForward": "major" }, "tools": { - "dotnet": "5.0.100-preview.8.20417.9", + "dotnet": "5.0.100-rc.1.20452.10", "vs": { "version": "16.8" }, diff --git a/src/Compilers/Core/Portable/InternalUtilities/PlatformAttributes.cs b/src/Compilers/Core/Portable/InternalUtilities/PlatformAttributes.cs new file mode 100644 index 0000000000000..4990bae8264d3 --- /dev/null +++ b/src/Compilers/Core/Portable/InternalUtilities/PlatformAttributes.cs @@ -0,0 +1,94 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#nullable enable + +#if !NET5_0 + +namespace System.Runtime.Versioning +{ + /// + /// Base type for all platform-specific API attributes. + /// + internal abstract class OSPlatformAttribute : Attribute + { + private protected OSPlatformAttribute(string platformName) + { + PlatformName = platformName; + } + + public string PlatformName { get; } + } + + /// + /// Records the platform that the project targeted. + /// + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)] + internal sealed class TargetPlatformAttribute : OSPlatformAttribute + { + public TargetPlatformAttribute(string platformName) + : base(platformName) + { + } + } + + /// + /// Records the operating system (and minimum version) that supports an API. Multiple attributes can be + /// applied to indicate support on multiple operating systems. + /// + /// + /// Callers can apply a + /// or use guards to prevent calls to APIs on unsupported operating systems. + /// + /// A given platform should only be specified once. + /// + [AttributeUsage( + AttributeTargets.Assembly + | AttributeTargets.Class + | AttributeTargets.Constructor + | AttributeTargets.Enum + | AttributeTargets.Event + | AttributeTargets.Field + | AttributeTargets.Method + | AttributeTargets.Module + | AttributeTargets.Property + | AttributeTargets.Struct, + AllowMultiple = true, Inherited = false)] + internal sealed class SupportedOSPlatformAttribute : OSPlatformAttribute + { + public SupportedOSPlatformAttribute(string platformName) + : base(platformName) + { + } + } + + /// + /// Marks APIs that were removed in a given operating system version. + /// + /// + /// Primarily used by OS bindings to indicate APIs that are only available in + /// earlier versions. + /// + [AttributeUsage( + AttributeTargets.Assembly + | AttributeTargets.Class + | AttributeTargets.Constructor + | AttributeTargets.Enum + | AttributeTargets.Event + | AttributeTargets.Field + | AttributeTargets.Method + | AttributeTargets.Module + | AttributeTargets.Property + | AttributeTargets.Struct, + AllowMultiple = true, Inherited = false)] + internal sealed class UnsupportedOSPlatformAttribute : OSPlatformAttribute + { + public UnsupportedOSPlatformAttribute(string platformName) + : base(platformName) + { + } + } +} + +#endif diff --git a/src/Compilers/VisualBasic/Portable/Semantics/OverloadResolution.vb b/src/Compilers/VisualBasic/Portable/Semantics/OverloadResolution.vb index 5509d712336c6..5dbbf1f4bf96b 100644 --- a/src/Compilers/VisualBasic/Portable/Semantics/OverloadResolution.vb +++ b/src/Compilers/VisualBasic/Portable/Semantics/OverloadResolution.vb @@ -502,12 +502,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic #If DEBUG Then ' Compile time asserts. Private Const s_delegateRelaxationLevelMask_AssertZero = SmallFieldMask.DelegateRelaxationLevelMask - ConversionKind.DelegateRelaxationLevelMask - Private _delegateRelaxationLevelMask_Assert1(s_delegateRelaxationLevelMask_AssertZero) As Boolean - Private _delegateRelaxationLevelMask_Assert2(-s_delegateRelaxationLevelMask_AssertZero) As Boolean + Private ReadOnly _delegateRelaxationLevelMask_Assert1(s_delegateRelaxationLevelMask_AssertZero) As Boolean + Private ReadOnly _delegateRelaxationLevelMask_Assert2(-s_delegateRelaxationLevelMask_AssertZero) As Boolean Private Const s_inferenceLevelMask_AssertZero = CByte((SmallFieldMask.InferenceLevelMask >> SmallFieldMask.InferenceLevelShift) <> ((TypeArgumentInference.InferenceLevel.Invalid << 1) - 1)) - Private _inferenceLevelMask_Assert1(s_inferenceLevelMask_AssertZero) As Boolean - Private _inferenceLevelMask_Assert2(-s_inferenceLevelMask_AssertZero) As Boolean + Private ReadOnly _inferenceLevelMask_Assert1(s_inferenceLevelMask_AssertZero) As Boolean + Private ReadOnly _inferenceLevelMask_Assert2(-s_inferenceLevelMask_AssertZero) As Boolean #End If Public Structure OptionalArgument Public ReadOnly DefaultValue As BoundExpression diff --git a/src/Interactive/HostProcess/InteractiveHost32.csproj b/src/Interactive/HostProcess/InteractiveHost32.csproj index ca1a0ee3144fb..5d501a10f47b7 100644 --- a/src/Interactive/HostProcess/InteractiveHost32.csproj +++ b/src/Interactive/HostProcess/InteractiveHost32.csproj @@ -16,6 +16,10 @@ + + + + diff --git a/src/Interactive/HostProcess/InteractiveHostEntryPoint.cs b/src/Interactive/HostProcess/InteractiveHostEntryPoint.cs index 31767e75964cc..f6ffb7d012fd7 100644 --- a/src/Interactive/HostProcess/InteractiveHostEntryPoint.cs +++ b/src/Interactive/HostProcess/InteractiveHostEntryPoint.cs @@ -4,6 +4,7 @@ using System; using System.Runtime.InteropServices; +using System.Runtime.Versioning; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -13,6 +14,7 @@ namespace Microsoft.CodeAnalysis.Interactive { internal static class InteractiveHostEntryPoint { + [SupportedOSPlatform("windows")] private static async Task Main(string[] args) { FatalError.Handler = FailFast.OnFatalException; @@ -51,9 +53,11 @@ private static async Task Main(string[] args) } } + [SupportedOSPlatform("windows")] [DllImport("kernel32", PreserveSig = true)] internal static extern ErrorMode SetErrorMode(ErrorMode mode); + [SupportedOSPlatform("windows")] [DllImport("kernel32", PreserveSig = true)] internal static extern ErrorMode GetErrorMode();