Skip to content

Commit

Permalink
Bump to Roslyn 4.11
Browse files Browse the repository at this point in the history
  • Loading branch information
sailro committed Aug 29, 2024
1 parent 4e72ac0 commit 904079a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.7.0" />
<!-- Analyzers -->
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="4.10.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="4.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" />
<!-- MPack -->
<PackageVersion Include="MonoDevelop.Addins" Version="0.4.7" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Win32.Registry" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" VersionOverride="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" VersionOverride="4.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="System.Reflection.MetadataLoadContext" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ namespace Microsoft.Unity.Analyzers.Tests;

public class NullableReferenceTypesSuppressorTest : BaseSuppressorVerifierTest<NullableReferenceTypesSuppressor>
{
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()
Expand Down Expand Up @@ -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),
];
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 904079a

Please sign in to comment.