Skip to content

DURABLE000* analyzers produce ArgumentException in Visual Studio #3173

@jholtmann

Description

@jholtmann

Description

When compiling a function app on the latest 1.6.0 or 1.6.1 builds Visual Studio produces numerous ArgumentException exceptions from within the new analyzers if an orchestrator or activity calls an extension method defined in a separate project. These warnings are not produced when running dotnet build directly.

Expected behavior

  • Code compiles without warnings.

Actual behavior

  • Analyzers throw exceptions during execution, resulting in "AD0001" warnings in Visual Studio after build.

Relevant source code snippets

    public class Demo
    {
        [Function(nameof(DemoOrchestrato))]
        public async Task DemoOrchestrato([OrchestrationTrigger] TaskOrchestrationContext context)
        {
            _ = context.DemoExtension();
            await context.CallActivityAsync(nameof(DemoActivity));
        }

        [Function(nameof(DemoActivity))]
        public async Task DemoActivity([ActivityTrigger] FunctionContext context)
        {
            context.GetLogger<Demo>().LogInformation("Hello from DemoActivity");
            await Task.Delay(1);
        }

        [Function(nameof(DemoTrigger))]
        public async Task<HttpResponseData> DemoTrigger(
            [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req,
            [DurableClient] DurableTaskClient starter,
            FunctionContext context
        )
        {
            context.GetLogger<Demo>().LogInformation("C# HTTP trigger function processed a request.");

            var instanceId = await starter.ScheduleNewOrchestrationInstanceAsync(nameof(DemoOrchestrato));
            return starter.CreateCheckStatusResponse(req, instanceId);
        }
    }

DemoFunctionApp.zip

Known workarounds

  • Downgrading to 1.5.0
  • Removing the extension method call (not an option in our case)

App Details

  • Microsoft.Azure.Functions.Worker.Extensions.DurableTask: 1.6.0+
  • Azure Functions runtime: 2.0
  • Language: C#

Screenshots

Image

Metadata

Metadata

Assignees

Labels

P1Priority 1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions