[UWP] Getting random exception updating the image

Good morning,
i get random exceptions updating the image in the SfImageEditor:

  The parameter is incorrect.

  The control does not currently have a CanvasDevice associated with it. Ensure that resources are created from a CreateResources or Draw event handler.


Is a UI Xaml generated exception, stacktrace:

   at Microsoft.Graphics.Canvas.CanvasBitmap.LoadAsync(ICanvasResourceCreator resourceCreator, IRandomAccessStream stream)
   at Syncfusion.UI.Xaml.ImageEditor.SfImageEditor.<GetImageStream>d__406.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore()

Code:

                this.Dispatcher.BeginInvokeOnMainThread(() =>
                {
                    this.sfImageEditor.Source = this.ProcessCapturedImage(stream);
                });


The same problem on multiple computers.

Xamarin Forms 4.7.0.1351
Syncfusion 18.3.0.40

Please it's urgent because we are in production.

Thanks in advance




2 Replies

MN Marco Negroni replied to Marco Negroni October 16, 2020 09:10 AM UTC

Good morning,
i get random exceptions updating the image in the SfImageEditor:

  The parameter is incorrect.

  The control does not currently have a CanvasDevice associated with it. Ensure that resources are created from a CreateResources or Draw event handler.


Is a UI Xaml generated exception, stacktrace:

   at Microsoft.Graphics.Canvas.CanvasBitmap.LoadAsync(ICanvasResourceCreator resourceCreator, IRandomAccessStream stream)
   at Syncfusion.UI.Xaml.ImageEditor.SfImageEditor.<GetImageStream>d__406.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore()

Code:

                this.Dispatcher.BeginInvokeOnMainThread(() =>
                {
                    this.sfImageEditor.Source = this.ProcessCapturedImage(stream);
                });


The same problem on multiple computers.

Xamarin Forms 4.7.0.1351
Syncfusion 18.3.0.40

Please it's urgent because we are in production.

Thanks in advance




I think that the problem is related about using of tasks.

How can i wait until the sfimageeditor has loaded the image in order to do something else? Ok there is the ImageLoaded event, but how can i wait it?

Thanks


RS Ramya Soundar Rajan Syncfusion Team October 19, 2020 09:32 AM UTC

Hi Marco Negroni, 
 
Greetings from Syncfusion. 
 
Query: How can i wait until the sfimageeditor has loaded the image in order to do something else? Ok there is the ImageLoaded event, but how can i wait it? 
 
We have analyzed your reported and checked in our side it’s working fine. Can you please provide the detailed information on the reported query since we were unaware of your exact use case of your requirement?  
 
Can you please share the following details?  
 
·       Can you please share whether you are trying to edit an image before image loaded in to SfImageEditor? 
·       If possible, can you please provide the code snippet or sample? 
·       Can you share the short demo for your requirement? 
·       Whether you are trying to make a delay to load an image in the SfImageEditor control? 
 
If this is not your requirement, can you please provide detailed information of your query. 

Based on your confirmation we are going to check the reported problem. We hope it makes clear that we can work on this without having a misleading to proceed further in our side.
 
 
Regards, 
Ramya S 


Loader.
Up arrow icon