C
C#•4d ago
HiveMynd

Unidentifiable Crash with ASP.NET

Hello Folks, I am using a ASP.NET Razor Pages and MS SQL Server to create a Basic CRUD website. Within this website there is a Page that allows the user to directly import data from a Excel File (with EPPlus) to the Database. However, Following a Reinstall of MS SQL Server, the Import Data page is crashing the website with No specific Errors or Exceptions. The Log always shows Exit Code -1 (0xffffffff) and even with Exception logging in multiple places, it is coming up Empty. I have also tried with Previous versions I have saved but with the same issue. The Crash always occurs when you Click the Browse button and then Close the file explorer either by Selecting a File or just Canceling the operation. I have Attached a 7Zip file of the Solution, The Affected Page is in the D:\ASP\SQLYard\SQLYard\Pages\Categories Folder under the name "BulkImport". https://github.com/HiveMynd148/SQLYard
53 Replies
Angius
Angius•4d ago
People are generally wary of downloading random files from the internet, so you'll have better chances of someone taking a look at it if you were to make a repo on Github and link that
HiveMynd
HiveMyndOP•4d ago
uhh ok I'll try that
becquerel
becquerel•4d ago
I believe the most common way to get a crash in .NET that has no stack trace etc is to cause a stack overflow It's relatively easy to accidentally do that by having a property or whatever that refers to itself (instead of a field), instantly causing infinite recursion Have you tried debugging this, anyway? Can you hit a breakpoint in your exception handlers?
HiveMynd
HiveMyndOP•4d ago
No actually Lemme just push this on git It's a Really REALLY wierd bug Added the Repo @becquerel @Angius I am genuinely stumped at this point
becquerel
becquerel•4d ago
what's the closest you can get to the crash while debugging? what method is it that runs in relation to this?
The Crash always occurs when you Click the Browse button and then Close the file explorer either by Selecting a File or just Canceling the operation.
OnPostImportAsync(), right?
HiveMynd
HiveMyndOP•4d ago
It doesn't even get there I put Breakpoints there and it never reached it I think the Problem might be in IFormFile, Line 22
becquerel
becquerel•4d ago
why do you say that?
HiveMynd
HiveMyndOP•4d ago
Because it breaks there I think The problem is right when you close the File Explorer to select a file, either by Selecting a file or canceling the operation
becquerel
becquerel•4d ago
iformfile isn't in your solution, so where are you seeing that it's breaking there?
HiveMynd
HiveMyndOP•4d ago
what wait no I meant in Line 22 in the BulkImport.cshtml.cs
becquerel
becquerel•4d ago
i see if you suspect something is breaking in the asp.net core model binding process, i'd lower the log levels for that and examine those while it's running
HiveMynd
HiveMyndOP•4d ago
it's just, Wierd this crash. Even with Task Manager doesn't show memory maxing out
becquerel
becquerel•4d ago
that is, the Microsoft.AspNetCore line in your appsettings.json throw it down to debug
HiveMynd
HiveMyndOP•4d ago
how do I do that? I a REALLY Green Beginner
becquerel
becquerel•4d ago
change the line "Microsoft.AspNetCore": "Warning" to "Microsoft.AspNetCore": "Debug" you should start seeing a lot more output in your logs
HiveMynd
HiveMyndOP•4d ago
oh ok
becquerel
becquerel•4d ago
though i'm surprised you're apparently not seeing something suspect in your logs already if your app is crashing
HiveMynd
HiveMyndOP•4d ago
yep still nothing
D:\ASP\SQLYard\SQLYard\bin\Debug\net8.0\SQLYard.exe (process 15092) exited with code -1.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
D:\ASP\SQLYard\SQLYard\bin\Debug\net8.0\SQLYard.exe (process 15092) exited with code -1.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
The program '[15092] SQLYard.exe' has exited with code 4294967295 (0xffffffff).
The program '[15092] SQLYard.exe' has exited with code 4294967295 (0xffffffff).
becquerel
becquerel•4d ago
that looks like you're getting zero logs at all?
HiveMynd
HiveMyndOP•4d ago
No I am but everything above is Routine
HiveMynd
HiveMyndOP•4d ago
becquerel
becquerel•4d ago
the final lines before the crash being from ef core is interesting where are you using EF? ah, identity, i see
HiveMynd
HiveMyndOP•4d ago
yea I needed a Login and logout system And for the Registration, I did it in a REALLY ass-backwards way but that's not the problem atm
becquerel
becquerel•4d ago
you don't seem to have any asp.net core logs in there for hitting the bulkimport page endpoint at all
HiveMynd
HiveMyndOP•4d ago
exactly, I have no idea where it is breaking Could it be the database?
becquerel
becquerel•4d ago
i would doubt it, if you're unable to hit the breakpoints in OnPostAsync
HiveMynd
HiveMyndOP•4d ago
I swear to god I have had less problematic Bugs in Unity
becquerel
becquerel•4d ago
unfortunately i can't run your app to test this since it's reliant on your database
HiveMynd
HiveMyndOP•4d ago
It's just a basic Microsoft SQL Server database Running Locally
becquerel
becquerel•4d ago
my advice from this point would be to try to minimise a reproducible example strip out as much as you can to isolate what is causing the issue i.e. make a blank page with nothing but an upload button that goes to your handler and also try to get the logs from asp.net core working
HiveMynd
HiveMyndOP•4d ago
alright then, Will update
TropicalSky
TropicalSky•4d ago
I had the same issue I was making a basic CRUD application as well with ASP.NET and whenever I would upload a file it would crash I got the same error as you and it would never hit the backend so I have no clue why it crashed If you figure it out please update lol
HiveMynd
HiveMyndOP•4d ago
Yea I will, this is a really wierd crash It used to work before I had to wipe my PC
ACiDCA7
ACiDCA7•4d ago
usually windows will create a windows crashreport in eventviewer when your app hard crashes. in the event you can see a exceptioncodes eg. -0xc00000fd stackoverflow -0xc0000005 out of memory etc when you identified the exception that causes your app to hardcrash you can spinup procdump which can automatically create dumps when exceptions occur, including the ones that cant be handled easily in dotnet(eg the ones above). after the dump has been created open the dump in visual studio or viewer of choice to get a better insight
HiveMynd
HiveMyndOP•3d ago
well the crash is like, The Console says the app exited almost like I stopped it manually Ok so Gentlemen, an Update @TropicalSky I just Replaced the Browse functionality for Drag and Drop @Becquerel The Problem is Definitely in the HTML
becquerel
becquerel•3d ago
oh, do you know what was broken with it?
HiveMynd
HiveMyndOP•3d ago
no 😭 It's likely the component in the browser Like, The Drag and Drop fixed it but the Export file is still broken like as soon as that Dialogue to "Press OK to Download" pops up, the thing exits
becquerel
becquerel•3d ago
curious i almost wonder if it's some security thing in your browser... but it's hard for me to be certain or even confident are you able to get any file-picker dialog working, say in a new blank project?
HiveMynd
HiveMyndOP•3d ago
haven't checked, but rn for me getting this fixed is Priority I need to meet my deadline dude T_T
becquerel
becquerel•3d ago
:PepeHands: my condolences
HiveMynd
HiveMyndOP•3d ago
yea.... anyway are there any alternatives? Like the File Generation Logic in the OnActionExportAsync() is working flawlessly it's just Interaction with the Confirmation menu is crashing it This is some wierd ass shit bruv
becquerel
becquerel•3d ago
it's been a long time since i worked with file uploads in asp.net core, so i wouldn't be a good source for alternatives if you have drag and drop working it's at least a start one thing i didn't think of before, do you have 'async void' methods anywhere in this call stack? exceptions thrown in async void methods will just kill your entire app silently...
HiveMynd
HiveMyndOP•3d ago
idk man maybe half this code was generated with GPT well I don't see any void methods what the fuck @Becquerel YO THE CRAZIEST SHIT JUST HAPPENED So On the Download Confirmation Dialogue, I just ticked "Do Not ask again for files like this" AND IT FIXED ITSELF WHAT THE HELL i am gonna go mad man im gonna contract some kind of mental illness
becquerel
becquerel•3d ago
:thonking: cool computers are fun
HiveMynd
HiveMyndOP•3d ago
Could it be Firefox? I think it's Firefox cuz Nothing else makes sense I need a damn Exorcist man I need the damn Archbishop this is some fucked up shit this bug Single handedly has me questioning my mental sanity
becquerel
becquerel•3d ago
there will be some explanation for why it happened computers are deterministic at the end of the day the answer is always to isolate variables
HiveMynd
HiveMyndOP•3d ago
This stuff is Beyond Human Comprehension
becquerel
becquerel•3d ago
does the same code show the same behaviour on different browsers, on different operating systems, on different versions of .NET, etc
HiveMynd
HiveMyndOP•3d ago
My Major is AI, I have seen Neural Networks more Explainable than this shit
becquerel
becquerel•3d ago
eventually you can narrow down the factors causing the bug the fact that ticking 'do not ask again' fixes it is a very strong clue i feel like some security policy in firefox interacting poorly with asp.net core
HiveMynd
HiveMyndOP•3d ago
yea anyway i am 99% sure it's the Browser
TropicalSky
TropicalSky•3d ago
Thank you so much I will have to try that out in my application because whenever I would click the okay button it would do the same thing as you and crash
HiveMynd
HiveMyndOP•3d ago
Replace the Browse with Drag and Drop, and for Download, well I just jerryrigged it for now
Want results from more Discord servers?
Add your server