From 96c1f2cd60107d3d3abb249a329812f5fb77724b Mon Sep 17 00:00:00 2001 From: Sebastien Lebreton Date: Fri, 30 Aug 2024 10:16:02 +0200 Subject: [PATCH] Bump to Roslyn 4.11 (#351) --- src/Directory.Packages.props | 2 +- .../Microsoft.Unity.Analyzers.Tests.csproj | 2 +- .../NullableReferenceTypesSuppressorTests.cs | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 25cd09c..c3e9966 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -10,7 +10,7 @@ - + diff --git a/src/Microsoft.Unity.Analyzers.Tests/Microsoft.Unity.Analyzers.Tests.csproj b/src/Microsoft.Unity.Analyzers.Tests/Microsoft.Unity.Analyzers.Tests.csproj index 05260f0..8cc6406 100644 --- a/src/Microsoft.Unity.Analyzers.Tests/Microsoft.Unity.Analyzers.Tests.csproj +++ b/src/Microsoft.Unity.Analyzers.Tests/Microsoft.Unity.Analyzers.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/Microsoft.Unity.Analyzers.Tests/NullableReferenceTypesSuppressorTests.cs b/src/Microsoft.Unity.Analyzers.Tests/NullableReferenceTypesSuppressorTests.cs index d7ece9a..e824c06 100644 --- a/src/Microsoft.Unity.Analyzers.Tests/NullableReferenceTypesSuppressorTests.cs +++ b/src/Microsoft.Unity.Analyzers.Tests/NullableReferenceTypesSuppressorTests.cs @@ -11,7 +11,8 @@ namespace Microsoft.Unity.Analyzers.Tests; public class NullableReferenceTypesSuppressorTest : BaseSuppressorVerifierTest { - public const string WarningFormat = "Non-nullable {0} '{1}' must contain a non-null value when exiting constructor. Consider declaring the {0} as nullable."; + public const string WarningFieldFormat = "Non-nullable {0} '{1}' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable."; + public const string WarningPropertyFormat = "Non-nullable {0} '{1}' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable."; [Fact] public async Task NonUnityClassIsExemptFromSuppressions() @@ -45,12 +46,12 @@ private void Start() DiagnosticResult[] diagnostics = [ DiagnosticResult.CompilerWarning(NullableReferenceTypesSuppressor.Rule.SuppressedDiagnosticId) - .WithMessageFormat(WarningFormat) + .WithMessageFormat(WarningFieldFormat) .WithArguments("field", "field1") .WithLocation(9, 28), DiagnosticResult.CompilerWarning(NullableReferenceTypesSuppressor.Rule.SuppressedDiagnosticId) - .WithMessageFormat(WarningFormat) + .WithMessageFormat(WarningPropertyFormat) .WithArguments("property", "property1") .WithLocation(11, 28), ]; @@ -160,7 +161,7 @@ private void InitializeField2() ExpectSuppressor(NullableReferenceTypesSuppressor.Rule).WithLocation(18, 27), //staticField DiagnosticResult.CompilerWarning(NullableReferenceTypesSuppressor.Rule.SuppressedDiagnosticId) - .WithMessageFormat(WarningFormat) + .WithMessageFormat(WarningFieldFormat) .WithArguments("field", "hiddenField") .WithLocation(20, 38), //should throw on public fields that are not shown in the inspector