-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
Description
The latest changes to the analyzers with 1.12.0
have introduced some false positives with rule DURABLE2001
including:
- Flagging missing input on activities that bind to
FunctionContext
for theirActivityTrigger
when used in Azure Functions:
[Function(nameof(GetNumber))]
public async Task<int> GetNumber([ActivityTrigger] FunctionContext context)
{
// Something ...
}
[Function(nameof(DoMath))]
public async Task DoMath([OrchestrationTrigger] TaskOrchestrationContext context)
{
// error DURABLE2001: CallActivityAsync is passing the incorrect type 'none' instead of 'FunctionContext' to the activity function 'GetNumber'
int num = await context.CallActivityAsync<int>(nameof(GetNumber));
// ... More stuff ...
}
- Polymorphism does not seem to be considered properly on input. E.g. a
List<int>
argument is flagged as invalid when passed to an activity that acceptsIReadOnlyList<int>
. I know this can be a bit hairy given the extension's own JSON representation though.- Or perhaps all types represented by the same JSON type are acceptable alternatives? E.g. Any .NET BCL collection is a JSON array, so they can be interchanged? Although, that may rely too much on implementation details
[Function(nameof(Sum))]
public int Sum([ActivityTrigger] IReadOnlyList<int> numbers)
=> numbers.Sum();
[Function(nameof(DoMath))]
public async Task DoMath([OrchestrationTrigger] TaskOrchestrationContext context)
{
// error DURABLE2001: CallActivityAsync is passing the incorrect type 'List<int>' instead of 'IReadOnlyList<int>' to the activity function 'Sum'
List<int> numbers = [1, 2, 3, 4, 5];
int sum = await context.CallActivityAsync<int>(nameof(Sum), numbers);
// ... More stuff ...
}
biltongza