Skip to content

Missing ConfigureAwait in PageIterator.IntrapageIterateAsync #1059

@Another-Ralf

Description

@Another-Ralf

Describe the bug

I'm using Graph from an old 4.8.1 Framework project predating the async paradigm that has its own Multithreading backend. So i need to bridge the async/sync Barrier somehow and did that successfully with one exclusion. I have a seldom deadlock when iterating over graph results via calls to
await pageIterator.IterateAsync().ConfigureAwait(false);
and then at the some point bringing it back into my thread via .GetAwaiter().GetResult();.

Tried all known variants here to get that synchronized back. Wrapping calls in Task.Run writing my own SynchronizationContext (there shouldn't be one involved beforehand it is not a winforms application or something like that) etc. Nothing helped.

What worked for me in the end was adding a ConfigureAwait(false) in the PageIterator.IntrapageIterateAsync(CancellationToken) code when it calls _requestAdapter.SendAsync
and building the Graph.Core package myself.

Expected behavior

The PageIterator should not deadlock when used in certain contexts.

How to reproduce

Have a NET. Framework host application not written as "async all the way" try to concurrently retrieve data (like mailbox folder content from multiple mailboxes) that needs iterating and wait for a deadlock.

SDK Version

4.0.1

Latest version known to work for scenario above?

Don't use non async/await based code anymore. But i can't ;(

Known Workarounds

n/a

Debug output

n/a

Configuration

All currently supported Windows Desktop and Server Versions in x64 (presumably also x86 but have not tested)
Net. Framework 4.8.1

Presumably not specific to that configurations

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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions