pose icon indicating copy to clipboard operation
pose copied to clipboard

Isolating async calls

Open ghost opened this issue 7 years ago • 6 comments

How on earth are you meant to isolate async calls? I've tried working round the issue with PoseContext.Isolate(async () => {}) and PoseContext.Isolate(() => Task.Run(async () => {})); but both throw compiler errors.

Any guidance/thoughts?

ghost avatar Jun 07 '18 22:06 ghost

PoseContext doesn't support specifying async delegates directly. The best thing to do will be to create a separate async method and pass that to PoseContext. E.g.

public async void SomeMethodAsync()
{
    Task.Run(() => {});
}

PoseContext(() => SomeMethodAsync());

tonerdo avatar Jun 10 '18 07:06 tonerdo

@tonerdo Looks like it doesn't support async full stop. Specifying an async method to pass to the Isolate method or returning a Task.Run that runs an async delegate from that method results in a compiler error. The only way I found to get this to work was to remove any asynchronous calls and hit the entry point synchronously. Not ideal, but it works I guess.

ghost avatar Jun 15 '18 21:06 ghost

+1 👍

ngorke avatar Apr 09 '19 07:04 ngorke

Is this bug fixed ???

Yullissa avatar Jun 22 '19 10:06 Yullissa

Any update on this?

ypedroo avatar Jul 16 '21 19:07 ypedroo

For support for async/await please see https://github.com/Miista/pose/issues/12

cc: @tonerdo @norgor @Yullissa @ypedroo @bramroelofs-tts

Miista avatar Jan 27 '24 20:01 Miista