Hi. I'm trying to build a drawing library which will target both Blazor and Xamarin SkiaSharp.
The problem I faced is that SkiaSharp apis are synchronous while blazor apis are async..
So I'm trying to make Blazor Canvas methods to work synchronously.
As far as I see Blazor synchronous methods are deprecated but are based on .GetAwaiter().GetResult() internally (in CallMethod<T>). I tried using that in test project:
My question is: are there any plans on restoring synchronous apis in future?
Maybe there is an easy way to call canvas apis synchronously?
Maybe I'm looking at wrong direction and it's better to have my library's drawing methods asynchronous but find a way to execute async code from SkiaSharp OnCanvasViewPaintSurface?
I'm yet to dig deeper into how SynchronizationContext works in blazor but wanted to check with somebody more experienced first.
Hi. I'm trying to build a drawing library which will target both Blazor and Xamarin SkiaSharp. The problem I faced is that SkiaSharp apis are synchronous while blazor apis are async..
So I'm trying to make Blazor Canvas methods to work synchronously.
As far as I see Blazor synchronous methods are deprecated but are based on
.GetAwaiter().GetResult()
internally (inCallMethod<T>
). I tried using that in test project:which didn't work and caused browser to hang.
My question is: are there any plans on restoring synchronous apis in future? Maybe there is an easy way to call canvas apis synchronously? Maybe I'm looking at wrong direction and it's better to have my library's drawing methods asynchronous but find a way to execute async code from SkiaSharp
OnCanvasViewPaintSurface
?I'm yet to dig deeper into how SynchronizationContext works in blazor but wanted to check with somebody more experienced first.
Thanks!