microsoftgraph / microsoftgraph/msgraph-beta-sdk-dotnet

SendCollectionAsync method never invokes the factory delegate

Open
#1,009 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:waiting-for-triage type:bug
Dominant language
C#
Stars
112
Forks
37
Avg merge
14h 57m
Merged PRs (30d)
3

Description

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_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the RequestAdapter.SendCollectionAsync entry point and compare its behavior with SendAsync using the reproduction shown in the issue. Verify that the factory delegate is invoked for each returned collection item, and confirm the existing SendAsync workaround still behaves as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.