WebRTCme icon indicating copy to clipboard operation
WebRTCme copied to clipboard

Suggestion: IAsyncDisposable

Open Psypher9 opened this issue 4 years ago • 1 comments

Hello! I noticed a few of the comments in the demo app here and also on the CallPage.razor.cs.

        public void Dispose()
        {
            Task.Run(async () => await ChatViewModel.OnPageDisappearingAsync());


            //// TODO: How to call async in Dispose??? Currently fire and forget!!!
            //Task.Run(async () => await _signallingServerService.DisposeAsync());
            //_webRtcMiddleware.Dispose();
        }

You may have already dealt with it by now, but I think for this use-case using the IAsyncDisposable interface should get you what you need and may be helpful for documentation.

I'm happy to make a PR for this, just wanted to contribute my thoughts on this.

Psypher9 avatar Apr 20 '22 03:04 Psypher9

Hi @Psypher9 and thanks for the suggestion.

I can't remember the exact details right now but I remember considering IAsyncDisposable in this case but I didn't. Perhaps ChatPage is a Blazor page and it does not support/call IAsyncDisposable (only IDisposable, at least at that time).

As I mentioned on other topics, I have no time to spend on this project right now, so if you think this can be done please issue a PR.

melihercan avatar Apr 20 '22 08:04 melihercan