-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable CA1810 as a warning #40384
Enable CA1810 as a warning #40384
Conversation
Contributes to dotnet#24055
using System.Diagnostics; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Microsoft.AspNetCore.Mvc.Razor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nearly all of the log messages on this types, except the one you see in the previous file, had been moved to individual types over time, and hence weren't referenced.
@@ -2,6 +2,7 @@ | |||
// The .NET Foundation licenses this file to you under the MIT license. | |||
|
|||
#nullable disable | |||
#pragma warning disable CA1810 // Initialize all static fields inline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try and do do this separately. The source generator does not like that we reuse ids.
$"{nameof(ResourceManagerStringLocalizer)} searched for '{{Key}}' in '{{LocationSearched}}' with culture '{{Culture}}'."); | ||
} | ||
|
||
public static void SearchedLocation(this ILogger logger, string key, string searchedLocation, CultureInfo culture) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this to ResourceManagerStringLocalizer
in the file below.
@@ -53,5 +38,15 @@ static Diagnostics() | |||
DiagnosticSeverity.Warning, | |||
isEnabledByDefault: true, | |||
helpLinkUri: "https://aka.ms/AA64fv1"); | |||
|
|||
public static readonly ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics = ImmutableArray.Create<DiagnosticDescriptor>(new[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Static fields are initialized in the order in which they appear, but you can reference them before they are initialized. Cool new thing I found out today.
Contributes to #24055
Contributes to #32087