Linked Questions

Popular Questions

IdentifierToken not being hit in Roslyn Analyzer

Asked by At

I'm attempting to write a Roslyn analyzer which needs to intercept calls to a function call WaitForExternalEvent and perform some logic on the arguments to that function. I have a syntax tree which looks like

Syntax tree

In code form it looks like

 public static class HireEmployee
    {
        [FunctionName("HireEmployee")]
        public static async Task<Application> RunOrchestrator(
            [OrchestrationTrigger] DurableOrchestrationContext context,
            ILogger log)
        {
            var applications = context.GetInput<List<Application>>();
            var approvals = await context.WaitForExternalEvent<List<Application>>("ApplicationsFiltered");
            log.LogInformation($"Approval received. {approvals.Count} applicants approved");
            return approvals.OrderByDescending(x => x.Score).First();
        }
...

When I register the action for this I do so like

context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.IdentifierName);

Breakpointing inside my AnalyzeSyntax method I do hit breakpoints for IdentifierName tokens but never for the WaitForExternalEvent token. Is there some limit to how deep tokens can be? How should I be going about finding these calls?

Related Questions