diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs index 3e388bebf0909..11d2f2ff2446d 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContext.cs @@ -542,6 +542,7 @@ public readonly struct CompilationAnalysisContext /// public CancellationToken CancellationToken { get { return _cancellationToken; } } + [Obsolete("Use CompilationWithAnalyzers instead. See https://github.com/dotnet/roslyn/issues/63440 for more details.")] public CompilationAnalysisContext(Compilation compilation, AnalyzerOptions options, Action reportDiagnostic, Func isSupportedDiagnostic, CancellationToken cancellationToken) : this(compilation, options, reportDiagnostic, isSupportedDiagnostic, null, cancellationToken) { @@ -658,7 +659,7 @@ public readonly struct SemanticModelAnalysisContext /// public bool IsGeneratedCode { get; } - // TODO: Mark obsolete, tracked with https://github.com/dotnet/roslyn/issues/63440 + [Obsolete("Use CompilationWithAnalyzers instead. See https://github.com/dotnet/roslyn/issues/63440 for more details.")] public SemanticModelAnalysisContext(SemanticModel semanticModel, AnalyzerOptions options, Action reportDiagnostic, Func isSupportedDiagnostic, CancellationToken cancellationToken) : this(semanticModel, options, reportDiagnostic, isSupportedDiagnostic, filterSpan: null, isGeneratedCode: false, cancellationToken) { @@ -736,7 +737,7 @@ public readonly struct SymbolAnalysisContext /// public bool IsGeneratedCode { get; } - // TODO: Mark obsolete, tracked with https://github.com/dotnet/roslyn/issues/63440 + [Obsolete("Use CompilationWithAnalyzers instead. See https://github.com/dotnet/roslyn/issues/63440 for more details.")] public SymbolAnalysisContext(ISymbol symbol, Compilation compilation, AnalyzerOptions options, Action reportDiagnostic, Func isSupportedDiagnostic, CancellationToken cancellationToken) : this(symbol, compilation, options, reportDiagnostic, isSupportedDiagnostic, isGeneratedCode: false, cancellationToken) { @@ -805,7 +806,7 @@ public abstract class SymbolStartAnalysisContext /// public CancellationToken CancellationToken { get; } - // TODO: Mark obsolete, tracked with https://github.com/dotnet/roslyn/issues/63440 + [Obsolete("Use CompilationWithAnalyzers instead. See https://github.com/dotnet/roslyn/issues/63440 for more details.")] public SymbolStartAnalysisContext(ISymbol symbol, Compilation compilation, AnalyzerOptions options, CancellationToken cancellationToken) : this(symbol, compilation, options, isGeneratedCode: false, cancellationToken) { @@ -954,7 +955,7 @@ public abstract class CodeBlockStartAnalysisContext where TLa /// public CancellationToken CancellationToken { get { return _cancellationToken; } } - // TODO: Mark obsolete, tracked with https://github.com/dotnet/roslyn/issues/63440 + [Obsolete("Use CompilationWithAnalyzers instead. See https://github.com/dotnet/roslyn/issues/63440 for more details.")] protected CodeBlockStartAnalysisContext(SyntaxNode codeBlock, ISymbol owningSymbol, SemanticModel semanticModel, AnalyzerOptions options, CancellationToken cancellationToken) : this(codeBlock, owningSymbol, semanticModel, options, isGeneratedCode: false, cancellationToken) { @@ -1049,7 +1050,7 @@ public readonly struct CodeBlockAnalysisContext /// public CancellationToken CancellationToken { get { return _cancellationToken; } } - // TODO: Mark obsolete, tracked with https://github.com/dotnet/roslyn/issues/63440 + [Obsolete("Use CompilationWithAnalyzers instead. See https://github.com/dotnet/roslyn/issues/63440 for more details.")] public CodeBlockAnalysisContext(SyntaxNode codeBlock, ISymbol owningSymbol, SemanticModel semanticModel, AnalyzerOptions options, Action reportDiagnostic, Func isSupportedDiagnostic, CancellationToken cancellationToken) : this(codeBlock, owningSymbol, semanticModel, options, reportDiagnostic, isSupportedDiagnostic, isGeneratedCode: false, cancellationToken) { @@ -1144,7 +1145,7 @@ public abstract class OperationBlockStartAnalysisContext /// public CancellationToken CancellationToken => _cancellationToken; - // TODO: Mark obsolete, tracked with https://github.com/dotnet/roslyn/issues/63440 + [Obsolete("Use CompilationWithAnalyzers instead. See https://github.com/dotnet/roslyn/issues/63440 for more details.")] protected OperationBlockStartAnalysisContext( ImmutableArray operationBlocks, ISymbol owningSymbol, @@ -1269,7 +1270,7 @@ public readonly struct OperationBlockAnalysisContext /// public CancellationToken CancellationToken => _cancellationToken; - // TODO: Mark obsolete, tracked with https://github.com/dotnet/roslyn/issues/63440 + [Obsolete("Use CompilationWithAnalyzers instead. See https://github.com/dotnet/roslyn/issues/63440 for more details.")] public OperationBlockAnalysisContext( ImmutableArray operationBlocks, ISymbol owningSymbol, @@ -1372,7 +1373,7 @@ public readonly struct SyntaxTreeAnalysisContext internal Compilation? Compilation => _compilationOpt; - // TODO: Mark obsolete, tracked with https://github.com/dotnet/roslyn/issues/63440 + [Obsolete("Use CompilationWithAnalyzers instead. See https://github.com/dotnet/roslyn/issues/63440 for more details.")] public SyntaxTreeAnalysisContext(SyntaxTree tree, AnalyzerOptions options, Action reportDiagnostic, Func isSupportedDiagnostic, CancellationToken cancellationToken) : this(tree, options, reportDiagnostic, isSupportedDiagnostic, compilation: null, isGeneratedCode: false, cancellationToken) { @@ -1519,13 +1520,13 @@ public readonly struct SyntaxNodeAnalysisContext /// public CancellationToken CancellationToken => _cancellationToken; - // TODO: Mark obsolete, tracked with https://github.com/dotnet/roslyn/issues/63440 + [Obsolete("Use CompilationWithAnalyzers instead. See https://github.com/dotnet/roslyn/issues/63440 for more details.")] public SyntaxNodeAnalysisContext(SyntaxNode node, ISymbol? containingSymbol, SemanticModel semanticModel, AnalyzerOptions options, Action reportDiagnostic, Func isSupportedDiagnostic, CancellationToken cancellationToken) : this(node, containingSymbol, semanticModel, options, reportDiagnostic, isSupportedDiagnostic, isGeneratedCode: false, cancellationToken) { } - // TODO: Mark obsolete, tracked with https://github.com/dotnet/roslyn/issues/63440 + [Obsolete("Use CompilationWithAnalyzers instead. See https://github.com/dotnet/roslyn/issues/63440 for more details.")] public SyntaxNodeAnalysisContext(SyntaxNode node, SemanticModel semanticModel, AnalyzerOptions options, Action reportDiagnostic, Func isSupportedDiagnostic, CancellationToken cancellationToken) : this(node, null, semanticModel, options, reportDiagnostic, isSupportedDiagnostic, isGeneratedCode: false, cancellationToken) { @@ -1610,7 +1611,7 @@ public readonly struct OperationAnalysisContext /// public CancellationToken CancellationToken => _cancellationToken; - // TODO: Mark obsolete, tracked with https://github.com/dotnet/roslyn/issues/63440 + [Obsolete("Use CompilationWithAnalyzers instead. See https://github.com/dotnet/roslyn/issues/63440 for more details.")] public OperationAnalysisContext( IOperation operation, ISymbol containingSymbol,