Skip to content

Commit 4bb4bbb

Browse files
committed
Enable build time warnings for IDE code analysis rules
* Enables build time warnings for readonly, modifier ordering and const * Fixes all of the warnings
1 parent c0de775 commit 4bb4bbb

File tree

388 files changed

+795
-792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

388 files changed

+795
-792
lines changed

.editorconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ dotnet_diagnostic.CA2208.severity = warning
195195
dotnet_diagnostic.IDE0035.severity = warning
196196

197197
# IDE0036: Order modifiers
198+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
198199
dotnet_diagnostic.IDE0036.severity = warning
199200

200201
# IDE0043: Format string contains invalid placeholder
@@ -204,7 +205,7 @@ dotnet_diagnostic.IDE0043.severity = warning
204205
dotnet_diagnostic.IDE0044.severity = warning
205206

206207
# IDE0073: File header
207-
dotnet_diagnostic.IDE0073.severity = warning
208+
dotnet_diagnostic.IDE0073.severity = suggestion
208209
file_header_template = Copyright (c) .NET Foundation. All rights reserved.\nLicensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
209210

210211
[**/{test,samples,perf}/**.{cs,vb}]

eng/targets/CSharp.Common.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
'$(ISBenchmarkProject)' == 'true' OR
2828
'$(IsSampleProject)' == 'true' OR
2929
'$(IsMicrobenchmarksProject)' == 'true'">$(NoWarn);CA1416</NoWarn>
30+
31+
<!-- Enable .NET code style analysis during build for src projects. -->
32+
<EnforceCodeStyleInBuild Condition="'$(EnforceCodeStyleInBuild)' == ''">true</EnforceCodeStyleInBuild>
3033
</PropertyGroup>
3134

3235
<ItemGroup Condition=" '$(DotNetBuildFromSource)' != 'true' AND $(AddPublicApiAnalyzers) ">

src/Analyzers/Analyzers/src/StartupAnalysis.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Analyzers
88
{
99
internal class StartupAnalysis
1010
{
11-
private ImmutableDictionary<INamedTypeSymbol, ImmutableArray<object>> _analysesByType;
11+
private readonly ImmutableDictionary<INamedTypeSymbol, ImmutableArray<object>> _analysesByType;
1212

1313
public StartupAnalysis(
1414
StartupSymbols startupSymbols,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static Diagnostics()
2727
});
2828
}
2929

30-
internal readonly static DiagnosticDescriptor BuildServiceProviderShouldNotCalledInConfigureServicesMethod = new DiagnosticDescriptor(
30+
internal static readonly DiagnosticDescriptor BuildServiceProviderShouldNotCalledInConfigureServicesMethod = new DiagnosticDescriptor(
3131
"ASP0000",
3232
"Do not call 'IServiceCollection.BuildServiceProvider' in 'ConfigureServices'",
3333
"Calling 'BuildServiceProvider' from application code results in an additional copy of singleton services being created. Consider alternatives such as dependency injecting services as parameters to 'Configure'.",
@@ -36,7 +36,7 @@ static Diagnostics()
3636
isEnabledByDefault: true,
3737
helpLinkUri: "https://aka.ms/AA5k895");
3838

39-
internal readonly static DiagnosticDescriptor UnsupportedUseMvcWithEndpointRouting = new DiagnosticDescriptor(
39+
internal static readonly DiagnosticDescriptor UnsupportedUseMvcWithEndpointRouting = new DiagnosticDescriptor(
4040
"MVC1005",
4141
"Cannot use UseMvc with Endpoint Routing.",
4242
"Using '{0}' to configure MVC is not supported while using Endpoint Routing. To continue using '{0}', please set 'MvcOptions.EnableEndpointRouting = false' inside '{1}'.",
@@ -45,7 +45,7 @@ static Diagnostics()
4545
isEnabledByDefault: true,
4646
helpLinkUri: "https://aka.ms/YJggeFn");
4747

48-
internal readonly static DiagnosticDescriptor IncorrectlyConfiguredAuthorizationMiddleware = new DiagnosticDescriptor(
48+
internal static readonly DiagnosticDescriptor IncorrectlyConfiguredAuthorizationMiddleware = new DiagnosticDescriptor(
4949
"ASP0001",
5050
"Authorization middleware is incorrectly configured.",
5151
"The call to UseAuthorization should appear between app.UseRouting() and app.UseEndpoints(..) for authorization to be correctly evaluated.",

src/Azure/AzureAD/Authentication.AzureADB2C.UI/src/AzureAdB2COpenIDConnectEventHandlers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Authentication.AzureADB2C.UI
1313
[Obsolete("This is obsolete and will be removed in a future version. Use Microsoft.Identity.Web instead. See https://aka.ms/ms-identity-web.")]
1414
internal class AzureADB2COpenIDConnectEventHandlers
1515
{
16-
private IDictionary<string, string> _policyToIssuerAddress =
16+
private readonly IDictionary<string, string> _policyToIssuerAddress =
1717
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
1818

1919
public AzureADB2COpenIDConnectEventHandlers(string schemeName, AzureADB2COptions options)

src/Caching/SqlServer/src/PlatformHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Microsoft.Extensions.Caching.SqlServer
77
{
88
internal static class PlatformHelper
99
{
10-
private static Lazy<bool> _isMono = new Lazy<bool>(() => Type.GetType("Mono.Runtime") != null);
10+
private static readonly Lazy<bool> _isMono = new Lazy<bool>(() => Type.GetType("Mono.Runtime") != null);
1111

1212
public static bool IsMono
1313
{
@@ -17,4 +17,4 @@ public static bool IsMono
1717
}
1818
}
1919
}
20-
}
20+
}

src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnosticsAnalyzerTest/UsesRendererTypesInDeclarations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers.Tests.TestFiles.ComponentInt
66
{
77
/*MMBaseClass*/class UsesRendererTypesInDeclarations : Renderer
88
{
9-
private Renderer /*MMField*/_field = null;
9+
private readonly Renderer /*MMField*/_field = null;
1010

1111
public UsesRendererTypesInDeclarations()
1212
/*MMInvocation*/: base(null, null)

src/Components/Components/src/CascadingParameterState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Components
1313
{
1414
internal readonly struct CascadingParameterState
1515
{
16-
private readonly static ConcurrentDictionary<Type, ReflectedCascadingParameterInfo[]> _cachedInfos = new();
16+
private static readonly ConcurrentDictionary<Type, ReflectedCascadingParameterInfo[]> _cachedInfos = new();
1717

1818
public string LocalValueName { get; }
1919
public ICascadingValueComponent ValueSupplier { get; }

src/Components/Components/src/DynamicComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Components
1616
public class DynamicComponent : IComponent
1717
{
1818
private RenderHandle _renderHandle;
19-
private RenderFragment _cachedRenderFragment;
19+
private readonly RenderFragment _cachedRenderFragment;
2020

2121
/// <summary>
2222
/// Constructs an instance of <see cref="DynamicComponent"/>.

src/Components/Components/src/Lifetime/ComponentApplicationLifetime.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Components.Lifetime
1616
public class ComponentApplicationLifetime
1717
{
1818
private bool _stateIsPersisted;
19-
private List<ComponentApplicationState.OnPersistingCallback> _pauseCallbacks = new();
19+
private readonly List<ComponentApplicationState.OnPersistingCallback> _pauseCallbacks = new();
2020
private readonly Dictionary<string, byte[]> _currentState = new();
2121
private readonly ILogger<ComponentApplicationLifetime> _logger;
2222

src/Components/Components/src/RenderTree/EventArgsTypeCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Components.RenderTree
99
{
1010
internal static class EventArgsTypeCache
1111
{
12-
private static ConcurrentDictionary<MethodInfo, Type> Cache = new ConcurrentDictionary<MethodInfo, Type>();
12+
private static readonly ConcurrentDictionary<MethodInfo, Type> Cache = new ConcurrentDictionary<MethodInfo, Type>();
1313

1414
public static Type GetEventArgsType(MethodInfo methodInfo)
1515
{

src/Components/Components/src/Rendering/RenderTreeBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ namespace Microsoft.AspNetCore.Components.Rendering
2020
/// </summary>
2121
public sealed class RenderTreeBuilder : IDisposable
2222
{
23-
private readonly static object BoxedTrue = true;
24-
private readonly static object BoxedFalse = false;
25-
private readonly static string ComponentReferenceCaptureInvalidParentMessage = $"Component reference captures may only be added as children of frames of type {RenderTreeFrameType.Component}";
23+
private static readonly object BoxedTrue = true;
24+
private static readonly object BoxedFalse = false;
25+
private static readonly string ComponentReferenceCaptureInvalidParentMessage = $"Component reference captures may only be added as children of frames of type {RenderTreeFrameType.Component}";
2626

2727
private readonly RenderTreeFrameArrayBuilder _entries = new RenderTreeFrameArrayBuilder();
2828
private readonly Stack<int> _openElementIndices = new Stack<int>();

src/Components/Components/src/Rendering/SimplifiedStringHashComparer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
1818
/// </summary>
1919
internal class SimplifiedStringHashComparer : IEqualityComparer<string>
2020
{
21-
public readonly static SimplifiedStringHashComparer Instance = new SimplifiedStringHashComparer();
21+
public static readonly SimplifiedStringHashComparer Instance = new SimplifiedStringHashComparer();
2222

2323
public bool Equals(string? x, string? y)
2424
{

src/Components/Components/test/Lifetime/ComponentApplicationLifetimeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public TestRenderer() : base(new ServiceCollection().BuildServiceProvider(), Nul
204204
{
205205
}
206206

207-
private Dispatcher _dispatcher = Dispatcher.CreateDefault();
207+
private readonly Dispatcher _dispatcher = Dispatcher.CreateDefault();
208208

209209
public override Dispatcher Dispatcher => _dispatcher;
210210

src/Components/Components/test/RendererTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4443,7 +4443,7 @@ protected override Task UpdateDisplayAsync(in RenderBatch renderBatch)
44434443
private class TestComponent : IComponent, IDisposable
44444444
{
44454445
private RenderHandle _renderHandle;
4446-
private RenderFragment _renderFragment;
4446+
private readonly RenderFragment _renderFragment;
44474447

44484448
public TestComponent(RenderFragment renderFragment)
44494449
{
@@ -5211,7 +5211,7 @@ public Task SetParametersAsync(ParameterView parameters)
52115211

52125212
private class TestErrorBoundary : AutoRenderComponent, IErrorBoundary
52135213
{
5214-
private TaskCompletionSource receivedErrorTaskCompletionSource = new();
5214+
private readonly TaskCompletionSource receivedErrorTaskCompletionSource = new();
52155215

52165216
public Exception ReceivedException { get; private set; }
52175217
public Task ReceivedErrorTask => receivedErrorTaskCompletionSource.Task;

src/Components/Components/test/Routing/RouteTableFactoryTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,8 +1013,8 @@ public void SuppliesNullForUnusedHandlerParameters()
10131013

10141014
private class TestRouteTableBuilder
10151015
{
1016-
IList<(string Template, Type Handler)> _routeTemplates = new List<(string, Type)>();
1017-
Type _handler = typeof(object);
1016+
readonly IList<(string Template, Type Handler)> _routeTemplates = new List<(string, Type)>();
1017+
readonly Type _handler = typeof(object);
10181018

10191019
public TestRouteTableBuilder AddRoute(string template, Type handler = null)
10201020
{

src/Components/Forms/src/ValidationStateChangedEventArgs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public sealed class ValidationStateChangedEventArgs : EventArgs
1313
/// <summary>
1414
/// Gets a shared empty instance of <see cref="ValidationStateChangedEventArgs"/>.
1515
/// </summary>
16-
public new static readonly ValidationStateChangedEventArgs Empty = new ValidationStateChangedEventArgs();
16+
public static new readonly ValidationStateChangedEventArgs Empty = new ValidationStateChangedEventArgs();
1717

1818
/// <summary>
1919
/// Creates a new instance of <see cref="ValidationStateChangedEventArgs" />

src/Components/Ignitor/src/NodeSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private class Serializer
3737
private readonly TextWriter _writer;
3838
private int _depth;
3939
private bool _atStartOfLine;
40-
private HashSet<Node> _visited = new HashSet<Node>();
40+
private readonly HashSet<Node> _visited = new HashSet<Node>();
4141

4242
public Serializer(TextWriter writer)
4343
{

src/Components/Server/test/Circuits/RemoteRendererTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public async Task RenderComponentAsync<TComponent>(ParameterView initialParamete
452452
private class TestComponent : IComponent, IHandleAfterRender
453453
{
454454
private RenderHandle _renderHandle;
455-
private RenderFragment _renderFragment = (builder) =>
455+
private readonly RenderFragment _renderFragment = (builder) =>
456456
{
457457
builder.OpenElement(0, "my element");
458458
builder.AddContent(1, "some text");

src/Components/Server/test/Circuits/RenderBatchWriterTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Components.Server
2020
{
2121
public class RenderBatchWriterTest
2222
{
23-
static object NullStringMarker = new object();
23+
static readonly object NullStringMarker = new object();
2424

2525
[Fact]
2626
public void CanSerializeEmptyRenderBatch()

src/Components/Web/src/Forms/EditContextFieldClassExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Components.Forms
1212
/// </summary>
1313
public static class EditContextFieldClassExtensions
1414
{
15-
private readonly static object FieldCssClassProviderKey = new object();
15+
private static readonly object FieldCssClassProviderKey = new object();
1616

1717
/// <summary>
1818
/// Gets a string that indicates the status of the specified field as a CSS class. This will include

src/Components/Web/src/Forms/FieldCssClassProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Components.Forms
1111
/// </summary>
1212
public class FieldCssClassProvider
1313
{
14-
internal readonly static FieldCssClassProvider Instance = new FieldCssClassProvider();
14+
internal static readonly FieldCssClassProvider Instance = new FieldCssClassProvider();
1515

1616
/// <summary>
1717
/// Gets a string that indicates the status of the specified field as a CSS class.

src/Components/WebAssembly/Server/src/TargetPickerUi.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public class TargetPickerUi
2727
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
2828
};
2929

30-
private string _browserHost;
31-
private string _debugProxyUrl;
30+
private readonly string _browserHost;
31+
private readonly string _debugProxyUrl;
3232

3333
/// <summary>
3434
/// Initialize a new instance of <see cref="TargetPickerUi"/>.

src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticatorCoreTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ public TestRemoteAuthenticationService(
752752
public Func<RemoteAuthenticationContext<RemoteAuthenticationState>, Task<RemoteAuthenticationResult<RemoteAuthenticationState>>> CompleteSignOutCallback { get; set; }
753753
public Func<ValueTask<ClaimsPrincipal>> GetAuthenticatedUserCallback { get; set; }
754754

755-
public async override Task<AuthenticationState> GetAuthenticationStateAsync() => new AuthenticationState(await GetAuthenticatedUserCallback());
755+
public override async Task<AuthenticationState> GetAuthenticationStateAsync() => new AuthenticationState(await GetAuthenticatedUserCallback());
756756

757757
public override Task<RemoteAuthenticationResult<RemoteAuthenticationState>> CompleteSignInAsync(RemoteAuthenticationContext<RemoteAuthenticationState> context) => CompleteSignInCallback(context);
758758

src/Components/WebAssembly/WebAssembly/src/HotReload/WebAssemblyHotReload.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.HotReload
2020
public static class WebAssemblyHotReload
2121
{
2222
private static HotReloadAgent? _hotReloadAgent;
23-
private static UpdateDelta[] _updateDeltas = new[]
23+
private static readonly UpdateDelta[] _updateDeltas = new[]
2424
{
2525
new UpdateDelta(),
2626
};

src/Components/WebAssembly/testassets/HostedInAspNet.Server/BootResourceRequestLog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace HostedInAspNet.Server
99
{
1010
public class BootResourceRequestLog
1111
{
12-
private ConcurrentBag<string> _requestPaths = new ConcurrentBag<string>();
12+
private readonly ConcurrentBag<string> _requestPaths = new ConcurrentBag<string>();
1313

1414
public IReadOnlyCollection<string> RequestPaths => _requestPaths;
1515

src/Components/WebAssembly/testassets/Wasm.Authentication.Client/PreferencesUserFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public PreferencesUserFactory(NavigationManager navigationManager, IAccessTokenP
2121
_httpClient = new HttpClient { BaseAddress = new Uri(navigationManager.BaseUri) };
2222
}
2323

24-
public async override ValueTask<ClaimsPrincipal> CreateUserAsync(
24+
public override async ValueTask<ClaimsPrincipal> CreateUserAsync(
2525
OidcAccount account,
2626
RemoteAuthenticationUserOptions options)
2727
{

src/Components/WebView/Samples/PhotinoPlatform/src/PhotinoWebViewManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ internal class PhotinoWebViewManager : WebViewManager
1919
// because webview2 won't let you do top-level navigation to such a URL.
2020
// On Linux/Mac, we must use a custom scheme, because their webviews
2121
// don't have a way to intercept http:// scheme requests.
22-
internal readonly static string BlazorAppScheme = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
22+
internal static readonly string BlazorAppScheme = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
2323
? "http"
2424
: "app";
2525

26-
internal readonly static string AppBaseUri
26+
internal static readonly string AppBaseUri
2727
= $"{BlazorAppScheme}://0.0.0.0/";
2828

2929
public PhotinoWebViewManager(PhotinoWindow window, IServiceProvider provider, Dispatcher dispatcher, Uri appBaseUri, IFileProvider fileProvider, string hostPageRelativePath)

src/Components/WebView/WebView/src/StaticContentProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal class StaticContentProvider
1515
private readonly Uri _appBaseUri;
1616
private readonly string _hostPageRelativePath;
1717
private static readonly FileExtensionContentTypeProvider ContentTypeProvider = new();
18-
private static ManifestEmbeddedFileProvider _manifestProvider =
18+
private static readonly ManifestEmbeddedFileProvider _manifestProvider =
1919
new ManifestEmbeddedFileProvider(typeof(StaticContentProvider).Assembly);
2020

2121
public StaticContentProvider(IFileProvider fileProvider, Uri appBaseUri, string hostPageRelativePath)

src/Components/WebView/WebView/test/Infrastructure/TestWebViewManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace Microsoft.AspNetCore.Components.WebView
99
{
1010
public class TestWebViewManager : WebViewManager
1111
{
12-
private static Uri AppBaseUri = new Uri("app://testhost/");
13-
private List<string> _sentIpcMessages = new();
12+
private static readonly Uri AppBaseUri = new Uri("app://testhost/");
13+
private readonly List<string> _sentIpcMessages = new();
1414

1515
public TestWebViewManager(IServiceProvider provider, IFileProvider fileProvider)
1616
: base(provider, Dispatcher.CreateDefault(), AppBaseUri, fileProvider, hostPageRelativePath: "index.html")

src/Components/benchmarkapps/Wasm.Performance/Driver/Selenium.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ namespace Wasm.Performance.Driver
1414
class Selenium
1515
{
1616
const int SeleniumPort = 4444;
17-
static bool RunHeadlessBrowser = true;
17+
const bool RunHeadlessBrowser = true;
1818

19-
static bool PoolForBrowserLogs = true;
19+
const bool PoolForBrowserLogs = true;
2020

2121
private static async ValueTask<Uri> WaitForServerAsync(int port, CancellationToken cancellationToken)
2222
{

src/Components/test/E2ETest/ServerExecutionTests/IgnitorTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected virtual Task InitializeAsync()
8383
return Task.CompletedTask;
8484
}
8585

86-
protected async virtual Task DisposeAsync()
86+
protected virtual async Task DisposeAsync()
8787
{
8888
if (TestSink != null)
8989
{

src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public InteropReliabilityTests(BasicTestAppServerSiteFixture<ServerStartup> serv
2727
{
2828
}
2929

30-
protected async override Task InitializeAsync()
30+
protected override async Task InitializeAsync()
3131
{
3232
var rootUri = ServerFixture.RootUri;
3333
await ConnectAutomaticallyAndWait(new Uri(rootUri, "/subdir"));

src/Components/test/E2ETestMigration/Infrastructure/PlaywrightTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class PlaywrightTestBase : LoggedTest, IAsyncLifetime
2525

2626
public PlaywrightTestBase(ITestOutputHelper output) : base(output) { }
2727

28-
protected async override Task InitializeCoreAsync(TestContext context)
28+
protected override async Task InitializeCoreAsync(TestContext context)
2929
{
3030
BrowserManager = await BrowserManager.CreateAsync(CreateConfiguration(), LoggerFactory);
3131
BrowserContextInfo = new ContextInformation(LoggerFactory);

src/Components/test/testassets/BasicTestApp/PrependMessageLoggerProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace BasicTestApp
1313
internal class PrependMessageLoggerProvider : ILoggerProvider
1414
{
1515
ILogger _logger;
16-
string _message;
17-
ILogger _defaultLogger;
16+
readonly string _message;
17+
readonly ILogger _defaultLogger;
1818
private bool _disposed = false;
1919

2020
public PrependMessageLoggerProvider(string message, IJSRuntime runtime)

src/Components/test/testassets/TestServer/Controllers/UserController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class UserController : Controller
1313
// to the client. It's up to the developer to choose what kind of authentication state
1414
// data is needed on the client so it can display suitable options in the UI.
1515
// In this class, we inform the client only about certain roles and certain other claims.
16-
static string[] ExposedRoles = new[] { "IrrelevantRole", "TestRole" };
16+
static readonly string[] ExposedRoles = new[] { "IrrelevantRole", "TestRole" };
1717

1818
// GET api/user
1919
[HttpGet]

src/Components/test/testassets/TestServer/ResourceRequestLog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace TestServer
88
{
99
public class ResourceRequestLog
1010
{
11-
private List<string> _requestPaths = new List<string>();
11+
private readonly List<string> _requestPaths = new List<string>();
1212

1313
public IReadOnlyCollection<string> RequestPaths => _requestPaths;
1414

0 commit comments

Comments
 (0)