microsoftgraph / microsoftgraph/msgraph-beta-sdk-dotnet
SendCollectionAsync method never invokes the factory delegate
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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