Developing with VS 2022 APS.NET Core MVC with Razor (with and without Docker) - Selecting a file for upload crashes VS debugging
How can this issue be reproduced?
Start a new ASP.Net Core-Web-App MVC .Net 8.0 ContainerOS Linux project in VS 2022
Add a razor file input or a simple HTML input:
<input asp-for="Image" type="file" class="form-control" accept="image/*" />
Start debug
Select an image
Debugging crashes
Expected result:
No crash of VS debugging
Brave Version( check About Brave
):
Version 1.66.118 Chromium: 125.0.6422.147 (Offizieller Build) (64-Bit)
Additional Information:
Developing with Windows 11 as host system. I am using docker, but have the crash with and without docker. First I thought would be a problem with my AntiForgeryToken, so I tried different approaches, ended up saving it in my MongoDB, but didn’t solve the problem. VS debugging crashes without any stacktrace. I just get:
Code 4294967295 (0xffffffff). Same on two different machines. After 10 hours trial end error I tried Edge and worked like it should, no crash. Same with Firefox. I have really no idea, why selecting a file with Brave during VS debugging crashes the debug session. The application is not in prod right now, still in dev. Also no console log or anything else in in dev-tools. Do you guys have any idea what’s going on? What kind of mechanism after selecting a file in a HTML file input can cause a VS debug session to crash?
1 Like
Oh, just found this
opened 09:42PM - 09 Dec 20 UTC
closed 06:17PM - 18 Feb 22 UTC
bug
External
investigate
area-blazor
severity-major
affected-very-few
### Describe the bug
When you implement a file upload using the <InputFile ... … /> or <input type="file ... /> controls, the server process crashes with the message.
```
...\path\to\BlazorApp1\BlazorApp1\bin\Debug\net5.0\BlazorApp1.exe (process 31424) exited with code -1.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
```
when using Vivaldi Browser (Version 3.4.2066.106 (Stable channel) (64-bit))
### To Reproduce
1. Create a new .Net 5.0 Blazor Server App
2. Change the Execution Text next to the "start"-Button in VS to your Projects name instead of "IIS Express"
3. Change the Browser that is used to start the project to Vivaldi
4. Open the Index.razor and paste the following at the end:
```
<InputFile OnChange="@UploadFile" />
@code{
private void UploadFile() { }
}
```
5. Start the project and select a file. The server application will close after the select file dialog is gone.
I am not 100% sure, but it may not be a problem with Blazor itself but with the way how Visual Studio detects if the application Website was closed and will stop debugging then. Because: if I don't use Vivaldi as the debugging browser but i.e. Chrome and open the website in Vivaldi manually and do the action above, everything is OK.
### Exceptions (if any)
No Exceptions. Just the regular message, when an application stopped debugging.
```
...\path\to\BlazorApp1\BlazorApp1\bin\Debug\net5.0\BlazorApp1.exe (process 31424) exited with code -1.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
```
### Further technical details
- ASP.NET Core version: 5.0
- The IDE: Visual Studio 2019 Community Version 16.8.2
dotnet --info:
.NET SDK (reflecting any global.json):
Version: 5.0.100
Commit: 5044b93829
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100\
Host (useful for support):
Version: 5.0.0
Commit: cf258a14b7
.NET SDKs installed:
2.1.2 [C:\Program Files\dotnet\sdk]
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.100 [C:\Program Files\dotnet\sdk]
2.1.104 [C:\Program Files\dotnet\sdk]
2.1.200 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.400 [C:\Program Files\dotnet\sdk]
2.1.401 [C:\Program Files\dotnet\sdk]
2.1.402 [C:\Program Files\dotnet\sdk]
2.1.403 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]
2.1.502 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.1.602 [C:\Program Files\dotnet\sdk]
2.1.700 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
So it could be a VS issue or a Brave issue. Closing the filepicker in Brave let VS think the Browser was closed. Really strange. Will report it to the VS team. But maybe you guys could also check why this happens and the differences in the closing event are in the brave browser compared to others. At least it seems it should be no problem in production.
Edit: Posted this also to the VS community
1 Like
system
Closed
July 11, 2024, 2:19pm
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.