Azure / Azure/azure-functions-dotnet-worker

Upgrade Assistant not handling IAsyncCollector

Open
#2,015 6 comments 3 reactions 1 assignee Claimed by @aishwaryabh View on GitHub
area: dotnet-upgrade-assistant bug team-issue
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

If a function contains `IAsyncCollector` or `ICollector` parameters, these are left in place and yield:

>Error CS0246 The type or namespace name 'IAsyncCollector<>' could not be found (are you missing a using directive or an assembly reference?)

In my example, there were a few other behaviors that also may be mixed in. This was observed when migrating a V4 in-proc app to .NET 8. I had a table output binding and a queue output binding, as `IAsyncCollector` and `IAsyncCollector`, respectively. `T` here is just a user-defined POCO type. The `TableAttribute` is incorreclty converted to a `TableInputAttribute`. The `QueueAttribute` is not converted at all, and this leads to two build errors;

>Error CS0246 The type or namespace name 'Queue' could not be found (are you missing a using directive or an assembly reference?)
Error CS0246 The type or namespace name 'QueueAttribute' could not be found (are you missing a using directive or an assembly reference?)

This example was using an HTTP trigger and therefore also had a return type of `Task`. The three outputs probably should be combined into a multi-output return, with arrays for the queue and table output. If that were done, there would still be build errors related to the calls into `IAsyncCollector.AddAsync()`, as well as for the return type presumably mismatching. A code comment should be added that explains the automated change and points them to https://aka.ms/af-dotnet-isolated-migration for instructions on how to make the right code changes.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.