Skip to content

SendCollectionAsync method never invokes the factory delegate #1009

@wictorwilen

Description

@wictorwilen

Describe the bug

I'm trying to use the SendCollectionAsync<T> to get a collection of items with a custom factory delegate. The method calls the API but the returned value is always an empty collection. However, if I use the SendAsync<T> method (on the same endpoint) it calls into the factory delegate.

Expected behavior

The expectations are that SendCollectionAsync<T> invokes the factory delegate for each item in the collection returned

How to reproduce

Code that does not work

var responseMessage = await graphClient.RequestAdapter.SendCollectionAsync<ExternalConnectionCollectionResponse>(
            requestInfo,
            ExternalConnectionCollectionResponse.CreateFromDiscriminatorValue,
            default,
            default);

Code that do work*

var responseMessage = await graphClient.RequestAdapter.SendAsync<ExternalConnectionCollectionResponse>(
            requestInfo,
            ExternalConnectionCollectionResponse.CreateFromDiscriminatorValue,
            default,
            default);

Note: the sample is using the default factory, instead of a custom delegate (which is my use case), for illustrative purposes. And the behavior is the same when using other model types.

SDK Version

5.107.0-preview

Latest version known to work for scenario above?

No response

Known Workarounds

You can use the SendAsync<T> - which is just awkward...

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions