Skip to content

Commit 7412976

Browse files
authored
Update Roslyn package versions (#23630)
* Update Roslyn package versions * Fixes * Fix analyzer warnings * Fix root cause for analyzer warnings * Fixed RuntimeCompilation test * Add back nowarns
1 parent 499a3bc commit 7412976

File tree

11 files changed

+17
-16
lines changed

11 files changed

+17
-16
lines changed

eng/Versions.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@
185185
<MicrosoftBuildFrameworkPackageVersion>15.8.166</MicrosoftBuildFrameworkPackageVersion>
186186
<MicrosoftBuildLocatorPackageVersion>1.2.6</MicrosoftBuildLocatorPackageVersion>
187187
<MicrosoftBuildUtilitiesCorePackageVersion>15.8.166</MicrosoftBuildUtilitiesCorePackageVersion>
188-
<MicrosoftCodeAnalysisCommonPackageVersion>3.4.0</MicrosoftCodeAnalysisCommonPackageVersion>
189-
<MicrosoftCodeAnalysisCSharpPackageVersion>3.4.0</MicrosoftCodeAnalysisCSharpPackageVersion>
190-
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>3.4.0</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
188+
<MicrosoftCodeAnalysisCommonPackageVersion>3.7.0-4.20351.7</MicrosoftCodeAnalysisCommonPackageVersion>
189+
<MicrosoftCodeAnalysisCSharpPackageVersion>3.7.0-4.20351.7</MicrosoftCodeAnalysisCSharpPackageVersion>
190+
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>3.7.0-4.20351.7</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
191191
<MicrosoftIdentityModelClientsActiveDirectoryPackageVersion>3.19.8</MicrosoftIdentityModelClientsActiveDirectoryPackageVersion>
192192
<MicrosoftIdentityModelLoggingPackageVersion>6.6.0</MicrosoftIdentityModelLoggingPackageVersion>
193193
<MicrosoftIdentityModelProtocolsOpenIdConnectPackageVersion>6.6.0</MicrosoftIdentityModelProtocolsOpenIdConnectPackageVersion>

src/Analyzers/Analyzers/src/MiddlewareAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System.Collections.Immutable;
@@ -33,7 +33,7 @@ public void AnalyzeConfigureMethod(OperationBlockStartAnalysisContext context)
3333
if (context.Operation is IInvocationOperation invocation &&
3434
invocation.Instance == null &&
3535
invocation.Arguments.Length >= 1 &&
36-
invocation.Arguments[0].Parameter?.Type == _context.StartupSymbols.IApplicationBuilder)
36+
SymbolEqualityComparer.Default.Equals(invocation.Arguments[0].Parameter?.Type, _context.StartupSymbols.IApplicationBuilder))
3737
{
3838
middleware.Add(new MiddlewareItem(invocation));
3939
}

src/Analyzers/Analyzers/src/ServicesAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System.Collections.Immutable;
@@ -28,7 +28,7 @@ public void AnalyzeConfigureServices(OperationBlockStartAnalysisContext context)
2828
if (context.Operation is IInvocationOperation invocation &&
2929
invocation.Instance == null &&
3030
invocation.Arguments.Length >= 1 &&
31-
invocation.Arguments[0].Parameter?.Type == _context.StartupSymbols.IServiceCollection)
31+
SymbolEqualityComparer.Default.Equals(invocation.Arguments[0].Parameter?.Type, _context.StartupSymbols.IServiceCollection))
3232
{
3333
services.Add(new ServicesItem(invocation));
3434
}

src/Analyzers/Analyzers/src/StartupAnalyzer.Diagnostics.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace Microsoft.AspNetCore.Analyzers
99
{
1010
public partial class StartupAnalyzer : DiagnosticAnalyzer
1111
{
12+
[System.Diagnostics.CodeAnalysis.SuppressMessage("MicrosoftCodeAnalysisReleaseTracking", "RS2008:Enable analyzer release tracking")]
1213
internal static class Diagnostics
1314
{
1415
public static readonly ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics;

src/Analyzers/Analyzers/src/StartupFacts.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,7 @@ public static bool IsConfigureServices(StartupSymbols symbols, IMethodSymbol sym
7474
return false;
7575
}
7676

77-
if (symbol.Parameters[0].Type != symbols.IServiceCollection)
78-
{
79-
return false;
80-
}
81-
82-
return true;
77+
return SymbolEqualityComparer.Default.Equals(symbol.Parameters[0].Type, symbols.IServiceCollection);
8378
}
8479

8580
// Based on StartupLoader. The philosophy is that we want to do analysis only on things
@@ -114,7 +109,7 @@ public static bool IsConfigure(StartupSymbols symbols, IMethodSymbol symbol)
114109
// IApplicationBuilder can appear in any parameter, but must appear.
115110
for (var i = 0; i < symbol.Parameters.Length; i++)
116111
{
117-
if (symbol.Parameters[i].Type == symbols.IApplicationBuilder)
112+
if (SymbolEqualityComparer.Default.Equals(symbol.Parameters[i].Type, symbols.IApplicationBuilder))
118113
{
119114
return true;
120115
}

src/Components/Analyzers/src/DiagnosticDescriptors.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace Microsoft.AspNetCore.Components.Analyzers
77
{
8+
[System.Diagnostics.CodeAnalysis.SuppressMessage("MicrosoftCodeAnalysisReleaseTracking", "RS2008:Enable analyzer release tracking")]
89
internal static class DiagnosticDescriptors
910
{
1011
// Note: The Razor Compiler (including Components features) use the RZ prefix for diagnostics, so there's currently

src/Mvc/Mvc.Analyzers/src/DiagnosticDescriptors.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace Microsoft.AspNetCore.Mvc.Analyzers
77
{
8+
[System.Diagnostics.CodeAnalysis.SuppressMessage("MicrosoftCodeAnalysisReleaseTracking", "RS2008:Enable analyzer release tracking")]
89
public static class DiagnosticDescriptors
910
{
1011
public static readonly DiagnosticDescriptor MVC1000_HtmlHelperPartialShouldBeAvoided =

src/Mvc/Mvc.Api.Analyzers/src/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ private void InitializeWorker(CompilationStartAnalysisContext context, ApiContro
8484
return;
8585
}
8686

87+
#pragma warning disable RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
8788
var semanticModel = operationAnalysisContext.Compilation.GetSemanticModel(methodSyntax.SyntaxTree);
89+
#pragma warning restore RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
8890
var methodSymbol = semanticModel.GetDeclaredSymbol(methodSyntax, operationAnalysisContext.CancellationToken);
8991

9092
if (!ApiControllerFacts.IsApiControllerAction(symbolCache, methodSymbol))

src/Mvc/Mvc.Api.Analyzers/src/ApiDiagnosticDescriptors.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace Microsoft.AspNetCore.Mvc.Api.Analyzers
77
{
8+
[System.Diagnostics.CodeAnalysis.SuppressMessage("MicrosoftCodeAnalysisReleaseTracking", "RS2008:Enable analyzer release tracking")]
89
internal static class ApiDiagnosticDescriptors
910
{
1011
public static readonly DiagnosticDescriptor API1000_ActionReturnsUndocumentedStatusCode =

src/Mvc/Mvc.Razor.RuntimeCompilation/test/RuntimeViewCompilerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ public void Compile_ReturnsGeneratedCodePath_IfLinePragmaIsNotAvailable()
765765
// Arrange
766766
var viewPath = "some-relative-path";
767767
var fileContent = "file content";
768-
var content = "this should fail";
768+
var content = "public class Bad { this should fail }";
769769

770770
var compiler = GetViewCompiler(new TestFileProvider());
771771
var codeDocument = RazorCodeDocument.Create(RazorSourceDocument.Create(fileContent, viewPath));

0 commit comments

Comments
 (0)