src/extensions/default/analyzers/Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers/TypeUpgradeAnalyzer.cs
/// <summary>
/// Initializes the analyzer by registering analysis callback methods.
/// </summary>
/// <param name="context">The context to use for initialization.</param>
Initializes the analyzer by registering analysis callback methods.
Initializes the analyzer by registering analysis callback methods .
public override void Initialize(AnalysisContext context)
        {
            if (context is null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            context.EnableConcurrentExecution();
            context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
            context.RegisterCompilationStartAction(context =>
            {
                var mappings = TypeMapLoader.LoadMappings(context.Options.AdditionalFiles);
                if (mappings.Any())
                {
                    context.RegisterSyntaxNodeAction(context => AnalyzeCSharpIdentifier(context, mappings), CS.SyntaxKind.IdentifierName);
                    context.RegisterSyntaxNodeAction(context => AnalyzeVBIdentifier(context, mappings), VB.SyntaxKind.IdentifierName);
                }
            });
        }
public override void Initialize ( AnalysisContext context ) { if ( context is null ) { throw new ArgumentNullException ( nameof ( context ) ) ; } context . EnableConcurrentExecution ( ) ; context . ConfigureGeneratedCodeAnalysis ( GeneratedCodeAnalysisFlags . Analyze | GeneratedCodeAnalysisFlags . ReportDiagnostics ) ; context . RegisterCompilationStartAction ( context => { var mappings = TypeMapLoader . LoadMappings ( context . Options . AdditionalFiles ) ; if ( mappings . Any ( ) ) { context . RegisterSyntaxNodeAction ( context => AnalyzeCSharpIdentifier ( context , mappings ) , CS . SyntaxKind . IdentifierName ) ; context . RegisterSyntaxNodeAction ( context => AnalyzeVBIdentifier ( context , mappings ) , VB . SyntaxKind . IdentifierName ) ; } } ) ; }
Initializes the analyzer by registering analysis callback methods.
Initializes the analyzer by registering analysis callback methods .
// Load analyzer configuration defining the types that should be mapped. // If type maps are present, register syntax node actions to analyze for those types // Register actions for handling both C# and VB identifiers
context
AnalysisContext
The context to use for initialization.
The context to use for initialization .