mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-24 20:52:11 +00:00
Apply the provider access rule to Razor markup as well
This commit is contained in:
parent
494e48ddd3
commit
292b52ddcb
@ -34,7 +34,12 @@ public sealed class ProviderAccessAnalyzer : DiagnosticAnalyzer
|
|||||||
|
|
||||||
public override void Initialize(AnalysisContext context)
|
public override void Initialize(AnalysisContext context)
|
||||||
{
|
{
|
||||||
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
|
//
|
||||||
|
// We analyze generated code as well, because Razor markup ends up in generated files. Without
|
||||||
|
// this, any `ConfigurationData.Providers` access written directly in a `.razor` file would
|
||||||
|
// bypass this rule entirely. The Razor compiler maps the diagnostic back to the `.razor` line:
|
||||||
|
//
|
||||||
|
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
|
||||||
context.EnableConcurrentExecution();
|
context.EnableConcurrentExecution();
|
||||||
context.RegisterSyntaxNodeAction(this.AnalyzeMemberAccess, SyntaxKind.SimpleMemberAccessExpression);
|
context.RegisterSyntaxNodeAction(this.AnalyzeMemberAccess, SyntaxKind.SimpleMemberAccessExpression);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user