Open divyesh008 opened 4 years ago
i am seeing this issue in version 3.0. Cannot access a disposed object. Object name: 'Xamarin.Controls.SignaturePadCanvasView'.
Steps to produce
scribble signature on signature pad navigate to other page navigates back to the page where signature control is signature control is empty and when I sign it crashes with above exception. (there is no error if we clear the control first) Event method where error occurred async void SignaturePad_StrokeCompleted(object sender, System.EventArgs e) { var signedImageStream = await SignaturePad.GetImageStreamAsync(SignatureImageFormat.Png);
var memoryStream = new System.IO.MemoryStream();
signedImageStream.CopyTo(memoryStream);
byte[] bytes = memoryStream.ToArray();
var fileContentBase64String = System.Convert.ToBase64String(bytes);
}
Please advise. Thx Balwinder
Not sure I understand this.
On Jun 23, 2020, at 1:55 PM, Dawid notifications@github.com wrote:
+1
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xamarin/SignaturePad/issues/176#issuecomment-647991012, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAV57EMDSXO37SSZUDM4BPLRYBRGHANCNFSM4JQNAIVQ.
Description
Signature pad throughs ObjectDisposedException exception while try to capture signature again without clearing the pad, if you clear the pad before capturing signature than it will work fine. Problem is only in Android in iOS it works fine.
Code
Expected Behavior
it must capture the signature if signed else just close the pad.
Actual Behavior
Throughs ObjectDisposedException with this message: Cannot access a disposed object. Object name: 'Xamarin.Controls.SignaturePadCanvasView'.
Stack trace:
at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <1effe20f448e48b697e82c3d8c9f59bb>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualInt32Method (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <1effe20f448e48b697e82c3d8c9f59bb>:0 at Android.Views.View.get_Width () [0x0000a] in:0
at Xamarin.Controls.Extensions.GetSize (Android.Views.View view) [0x00000] in <0c0873655a504a1796935fa2cfa62e06>:0
at Xamarin.Controls.SignaturePadCanvasView.GetImageConstructionArguments (Xamarin.Controls.ImageConstructionSettings settings, System.Drawing.SizeF& scale, System.Drawing.RectangleF& signatureBounds, System.Drawing.SizeF& imageSize, System.Single& strokeWidth, Android.Graphics.Color& strokeColor, Android.Graphics.Color& backgroundColor) [0x00084] in <0c0873655a504a1796935fa2cfa62e06>:0
at Xamarin.Controls.SignaturePadCanvasView.GetImageStreamAsync (Xamarin.Controls.SignatureImageFormat format, Xamarin.Controls.ImageConstructionSettings settings) [0x00000] in <0c0873655a504a1796935fa2cfa62e06>:0
at SignaturePad.Forms.SignaturePadCanvasRenderer.OnImageStreamRequested (System.Object sender, SignaturePad.Forms.SignaturePadCanvasView+ImageStreamRequestedEventArgs e) [0x00142] in :0
at (wrapper delegate-invoke) System.EventHandler`1[SignaturePad.Forms.SignaturePadCanvasView+ImageStreamRequestedEventArgs].invoke_void_object_TEventArgs(object,SignaturePad.Forms.SignaturePadCanvasView/ImageStreamRequestedEventArgs)
at SignaturePad.Forms.SignaturePadCanvasView.GetImageStreamAsync (SignaturePad.Forms.SignatureImageFormat imageFormat, SignaturePad.Forms.ImageConstructionSettings settings) [0x00012] in :0
at SignaturePad.Forms.SignaturePadCanvasView.GetImageStreamAsync (SignaturePad.Forms.SignatureImageFormat format, System.Boolean shouldCrop, System.Boolean keepAspectRatio) [0x0002f] in :0
at SignaturePad.Forms.SignaturePadView.GetImageStreamAsync (SignaturePad.Forms.SignatureImageFormat format, System.Boolean shouldCrop, System.Boolean keepAspectRatio) [0x00006] in :0
at Fracational.Views.Popups.SignaturePadPopView.OkClick (System.Object sender, System.EventArgs e) [0x0003e] in /Users/mac/Documents/Divyesh/Projects/Latest_Fracational/Fracational/Views/PopUps/SignaturePadPopView.xaml.cs:79