roslyn: CompilationAction not Triggering

I’m running into an issue with VS 2015 + Roslyn v1.

I read through the analyzer semantic documentation[1].

According to it, I expect that the compilation action I registered in the Initializer, to be executed once at the end of a compilation.

However I am not getting this behavior. The StartCompilation action gets called, but the End never does. Is this a bug? Am I doing it wrong?

        public override void Initialize(AnalysisContext context)
        {
            context.RegisterCompilationAction(this.OnCompilation);
            context.RegisterCompilationStartAction(this.OnStartCompilation);
        }

[1] https://github.com/dotnet/roslyn/blob/master/docs/analyzers/Analyzer Actions Semantics.md

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 55 (40 by maintainers)

Commits related to this issue

Most upvoted comments

@kentcb yep. I think we should make compilation end analyzer on opened files should work even if FSA is off. tagging @jinujoseph

we thought if one implements Compilation End Analyzer, one would do most of heavy work in compilation end callback since it gets compilation and with compilation, one can do everything he wants. and doing everything there is more efficient than managing states in multiple callbacks which make it stateful and cause all the complexity coming from it such as concurrency, thread safe and etc.

Does not work for me either. I’m trying

  • RegisterCompilationStartAction - works
  • RegisterCompilationAction (never called)
  • RegisterCompilationEndAction (never called)

Severity is “Warning”, full solution analysis is turned on.

I’m debugging the analyzer with visual studio. I started with the example project, then I press F5 to start a new instance of VS.

Diagnostics work, and codefixes work as well. But no matter what I do (rebuild, build, …) the complication end actions are never called. VisualStudio 2017 Version: 15.2 26430.6

@KrisVandermotten all compilation wide work happens out of proc (ServiceHub.RoslynCodeAnalysisServiceXX.exe) due to its heavy allocation potentials. you need to set breakpoint on that process to debug it.