Conversation
| if (ReportDiagnosticsOnGeneratedCode) | ||
| { | ||
| context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics); | ||
| } |
There was a problem hiding this comment.
Note: Analyze | ReportDiagnostics is already the default. So, currently ReportDiagnosticsOnGeneratedCode is broken. This wasn't observed because there are actually no analyzers that overrides this property to return false. So, it was always true.
|
I would love to get the understanding of the rationale of the change before accepting a refactoring. |
|
And TBH misc refactorings with 13 changed files and no description is not really friendly PR to accept :) |
|
@SergeyTeplyakov Yes, sorry. It is related to this comment (#266 (comment)) Let me know if you want me to expand more than that |
| return false; | ||
| } | ||
|
|
||
| var (taskType, taskOfTType, valueTaskOfTType) = GetTaskTypes(compilation); |
There was a problem hiding this comment.
This code path was repeatedly called, and GetTaskTypes would call compilation.GetTypeByMetadataName. For performance, it's recommended to do this call once, in compilation start (i.e, using RegisterCompilationStartAction).
So, instead of passing Compilation here, the symbols calculated in compilation start should be passed. Then, I needed to "group" all task symbols in TaskTypesInfo instead of passing multiple parameters here.
| var compilation = context.Compilation; | ||
|
|
||
| var configureAwaitConfig = ConfigureAwaitConfiguration.TryGetConfigureAwait(context.Compilation); | ||
| if (configureAwaitConfig != ConfigureAwait.UseConfigureAwaitFalse) |
There was a problem hiding this comment.
All callbacks are checking for this. So, we can actually check it once in compilation start, and not register any action at all when not needed.
|
|
||
| var yieldAwaitable = compilation.GetTypeByMetadataName(typeof(YieldAwaitable).FullName); | ||
|
|
||
| context.RegisterOperationAction(context => AnalyzeAwaitOperation(context, configureAwaitMethods, yieldAwaitable), OperationKind.Await); |
There was a problem hiding this comment.
Switched from syntax to operation.
At the end, GetOperation is called anyways.
No description provided.