gustavnavar / Grid.Blazor

Grid component with CRUD for Blazor (client-side and server-side) and ASP.NET Core MVC
GNU Lesser General Public License v2.1
696 stars 134 forks source link

File upload crushes in debug mode #391

Open AlexeyBoyko opened 1 year ago

AlexeyBoyko commented 1 year ago

For some reason it is not possible to debug my Blazor Server (NET 7.0) implementation of ICrudFileService because in debug mode file upload simply crushes without logging any messages to the console. Perhaps it is somehow related to the "File chooser dialog can only be shown with a user activation." problem which I encounter while debugging step-by-step ButtonFileClicked method. I was also able to hit breakpoint in OnChange() method of GridCreateComponent, but then it immediately crushes without any exceptions (adding try-catch inside OnChange and ErrorBoundary in my main layout didn't help to catch something). Seems that the process is simply killed. Upd: Eventually I have managed to debug my error since it occured to be earlier in ICrudDataService which does not depend on file upload component. Still, it is quite complex to debug file processing code (if one needs to) without debug mode with just writing "breakpoints" to console.

gustavnavar commented 1 year ago

Package 4.0.5 include try / catch in the OnChange method of GridCreateComponent and GridUpdateComponent

AlexeyBoyko commented 1 year ago

Thank you! But actually it does not help to catch the error. If I put breakpoint at the first line within try-catch block of OnChange() method, it stops there for a second or less and then application silently crushes without catching anything and hence nothing is written in console output (except that the process finished with code -1).

AlexeyBoyko commented 1 year ago

Just in case... have you tried it for yourself to upload file in debug mode? If it works smoothly, then could the reason of our app's crushing be some bug that you have fixed earlier this year? As a matter of fact we use GridBlazor source codes in our project (not package) and we have never updated them since March.

gustavnavar commented 1 year ago

I've just test it using one of my projects and it works fine in debug mode. The used version is 4.0.4.

I've also upgraded to the last version (4.0.5) with no issues.

By the way, this app uploads a file to the server, and the server stores it in Azure Store.

AlexeyBoyko commented 1 year ago

Hello! Eventually I decided to try out your example app and it failed in debug mode similarly just after I have chosen a file to upload. It stopped for about a second on the breakpoint on first line of the GridCreateComponent.OnChange() method and then crushed. I tried it on the EmployeeComponent.razor which shows up after clicking Employee's Grid label on Embedded page.

AlexeyBoyko commented 1 year ago

"By the way, this app uploads a file to the server, and the server stores it in Azure Store." - didn't really catch the point, how can the way we store file be related with the current problem of debugging the app?

AlexeyBoyko commented 1 year ago

As far as I understand your sample app (the one available after clicking on the "Employees" button of this sample https://gridblazor.azurewebsites.net/embedded) uploads file to cloud service. On the contrary, our app stores uploaded files in database. Still, both crush in debug mode just after the file has been chosen.