Expose constructor that allows for AnalysisOptions and a CancellationToken.
Fixes https://github.com/dotnet/roslyn/issues/41522.
The API here is definitely screwy. You can either provider AnalyzerOptions? options and a CancellationToken, or you can provide CompilationWithAnalyzersOptions analysisOptions but no cancellation token.
@jasonmalinowski @mavasani on this. Unless it was intentionaly that you not be allowed to pass a CT here, this seems broken. If we don't want people passing a CT here, we should doc why.
@dotnet/roslyn-compiler ptal. Thanks!
This adds a public API. Why isn't CI requiring this to be registered in the publicAPI tracking files?
no clue. @jasonmalinowski do we still do the publicapi thingy? or was that discontinued?
API Review
- API is approved.
public class CompilationWithAnalyzers
{
public CompilationWithAnalyzers(
Compilation compilation,
ImmutableArray<DiagnosticAnalyzer> analyzers,
CompilationWithAnalyzersOptions analysisOptions,
CancellationToken cancellationToken);
}
API was approved. @dotnet/roslyn-compiler @jcouv ptal. Thanks!
Converting this to a draft. Looking into ths more, we're actually very skeptical about this existing API to begin with. Namely, it allows a CT to be passed in, that is then never observed by anything in the system. So it feels like a better approach might be to deprecate the CT overloads and make it clear that it is unused.
Closing out in favor of https://github.com/dotnet/roslyn/pull/69108.