Chronostasys / Blazor.Cropper

A blazor library provides component to crop image
MIT License
84 stars 19 forks source link

Cropper - Object reference not set to an instance of an object. #36

Closed SarahFathy closed 2 years ago

SarahFathy commented 2 years ago

Hello, Thank you so much for the cropper. I used it in a project and it's pretty good. but, I have an issue when I try to upload photos it's frequent but not permenant issue. the exception is thrown as follows: PS: (I use blazor server and I added the configuration for signalR on MaximumReceiveMessageSize = 10MB)

blazor.server.js:1 Uncaught (in promise) Error: System.NullReferenceException: Object reference not set to an instance of an object. at Blazor.Cropper.Cropper.get_WiderThanContainer() at Blazor.Cropper.Cropper.GetI() at Blazor.Cropper.Cropper.SizeChanged() at Blazor.Cropper.Cropper.OnSizeChangeEnd(MouseEventArgs args) at Blazor.Cropper.Cropper.b__134_2(MouseEventArgs args) at Blazor.Cropper.Cropper.MouseUpCaller(MouseEventArgs args) --- End of stack trace from previous location --- at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime jsRuntime, DotNetInvocationInfo& callInfo, IDotNetObjectReference objectReference, String argsJson) at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson) at Object.endInvokeDotNetFromJS (https://localhost:44342/_framework/blazor.server.js:1:70618) at e. (https://localhost:44342/_framework/blazor.server.js:10:48412) at https://localhost:44342/_framework/blazor.server.js:1:26442 at Array.forEach () at e.invokeClientMethod (https://localhost:44342/_framework/blazor.server.js:1:26412) at e.processIncomingData (https://localhost:44342/_framework/blazor.server.js:1:24223) at e.connection.onreceive (https://localhost:44342/_framework/blazor.server.js:1:17308) at WebSocket.i.onmessage (https://localhost:44342/_framework/blazor.server.js:1:46784)

Chronostasys commented 2 years ago

Hi @SarahFathy , thank you for reporting this issue. PR #37 shall fix this null reference exception, and I'll publish a new version(1.2.1) shortly after the pr merged. Feel free to reopen this issue if the issue exists in v1.2.1.