diff --git a/.editorconfig b/.editorconfig index 1c4c4de875..0d7d396d7f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -393,6 +393,7 @@ dotnet_diagnostic.IDE0090.severity = warning # Use new(...) dotnet_diagnostic.IDE0220.severity = warning # Add explicit cast dotnet_diagnostic.IDE0250.severity = warning # Struct can be made 'readonly' dotnet_diagnostic.IDE0251.severity = suggestion # Struct methods can be made 'readonly' +dotnet_diagnostic.IDE0270.severity = suggestion # Use coalesce expression dotnet_diagnostic.IDE1006.severity = warning # Naming styles Task Open() Task OpenAsync() dotnet_diagnostic.IDE1006WithoutSuggestion.severity = suggestion @@ -442,4 +443,5 @@ dotnet_diagnostic.CA1307.severity = suggestion # Specify StringComparison # Disabling warning for C# files generated from xaml rules [artifacts/*/obj/Microsoft.VisualStudio.ProjectSystem.Managed/net8.0/*.cs] # CS0618: Type or member is obsolete -dotnet_diagnostic.CS0618.severity = silent \ No newline at end of file +dotnet_diagnostic.CS0618.severity = silent + diff --git a/tests/Common/ThrowingTraceListener.cs b/tests/Common/ThrowingTraceListener.cs index 316959811f..31c4d3ff99 100644 --- a/tests/Common/ThrowingTraceListener.cs +++ b/tests/Common/ThrowingTraceListener.cs @@ -1,7 +1,9 @@ // 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.md file in the project root for more information. using System.Diagnostics; +#if !NET8_0_OR_GREATER using System.Runtime.Serialization; +#endif namespace Microsoft.VisualStudio.Diagnostics { diff --git a/tests/Microsoft.VisualStudio.ProjectSystem.Managed.VS.UnitTests/ProjectSystem/VS/ComponentVerificationTests.cs b/tests/Microsoft.VisualStudio.ProjectSystem.Managed.VS.UnitTests/ProjectSystem/VS/ComponentVerificationTests.cs index 20285e8a77..5148e9d18c 100644 --- a/tests/Microsoft.VisualStudio.ProjectSystem.Managed.VS.UnitTests/ProjectSystem/VS/ComponentVerificationTests.cs +++ b/tests/Microsoft.VisualStudio.ProjectSystem.Managed.VS.UnitTests/ProjectSystem/VS/ComponentVerificationTests.cs @@ -21,8 +21,8 @@ public void ImportsMustFilterBasedOnCapabilities(Type type) foreach ((ImportDefinitionBinding import, IReadOnlyList exports) in part.SatisfyingExports) { - var importingProperty = import.ImportingMember as PropertyInfo; - if (importingProperty is null) // We don't verify ImportingConstructor, only check properties. + // Only check properties. We don't verify ImportingConstructor. + if (import.ImportingMember is not PropertyInfo importingProperty) return; Type memberType = importingProperty.PropertyType;