roslyn: CompilationEndAction not being called.
The UseAutoProp analyzer looks like this:
public sealed override void Initialize(AnalysisContext context)
{
context.RegisterCompilationStartAction(csac =>
{
var analysisResults = new ConcurrentBag<AnalysisResult>();
var ineligibleFields = new ConcurrentBag<IFieldSymbol>();
csac.RegisterSymbolAction(sac => AnalyzeProperty(analysisResults, sac), SymbolKind.Property);
RegisterIneligibleFieldsAction(csac, ineligibleFields);
csac.RegisterCompilationEndAction(cac => Process(analysisResults, ineligibleFields, cac));
});
}
Even though we call RegisterCompilationEndAction, the call to the registered lambda never happens.
This means that UseAutoProp doesn’t actually work at all.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Reactions: 1
- Comments: 77 (76 by maintainers)
Capturing notes from @heejaechang ( after discussion we had following this https://github.com/dotnet/roslyn/pull/19067 )
@jinujoseph are we going to push making compilation end analyzer first citizen in VS as we discussed in the meeting? I think we should have bug opened to track the work.
the work we discussed
…
we want (1) to gives users full experience. (2) is for people with solution whose machine can’t handle/beefy enough to handle FSA. (3, 4) are too make compilation end analyzer/fixer has similar experience as other analyzer/fixer (5, 6) are needed so that we can run limit work we needs for compilation end analyzers.
I’m not asking for the option to be on. We can have full-solution-analysis off by default. However, regardless of which value that option has, our API should still work as documented. For example, it could work that way by running these actions only on compilations for which we’re running the analyzer on. i.e. for something like Roslyn, it would only be for the documents that we’re running analyzers on. But not for any of hte closed projects.
With the default config that people had.
My point is that the change in this option has broken this feature. And it has broken anyone else who uses compilation-end-actions.
This is a significant issue, and it affects our ability to provide more code actions that we would like to provide. For example, features like Move-Method-Up/Down, Safe-Delete, etc. are all features that i needed Compilation-End-Actions to provide.
Full-solution-analysis was communicated as a feature that would affect which diagnostics you would see in Error-List. it was not ever communicated as something that would make it so that existing code actions would not work.
Right now there seems to be a bug here that we have code that is registering for something, and it is not being called. What are options for how we can get this action to be invoked?
I’m confused. Regardless of hte wording, the behavior of analyzers like these should not be affected at all by this option. If an analyzer asks for a CompilationEndAction to run, then we should run that action after analyzing the project. Full-solution-analysis should be about if we do analysis on projects that we don’t have any open documents for.