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
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
uhh ok I'll try that
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?
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
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?
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
why do you say that?
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
iformfile isn't in your solution, so where are you seeing that it's breaking there?
what
wait no I meant in Line 22 in the BulkImport.cshtml.cs
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
it's just, Wierd this crash. Even with Task Manager doesn't show memory maxing out
that is, the Microsoft.AspNetCore line in your appsettings.json
throw it down to debug
how do I do that?
I a REALLY Green Beginner
change the line
"Microsoft.AspNetCore": "Warning"
to
"Microsoft.AspNetCore": "Debug"
you should start seeing a lot more output in your logs
oh ok
though i'm surprised you're apparently not seeing something suspect in your logs already
if your app is crashing
yep still nothing
that looks like you're getting zero logs at all?
No I am
but everything above is Routine
the final lines before the crash being from ef core is interesting
where are you using EF?
ah, identity, i see
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
you don't seem to have any asp.net core logs in there for hitting the bulkimport page endpoint at all
exactly, I have no idea where it is breaking
Could it be the database?
i would doubt it, if you're unable to hit the breakpoints in OnPostAsync
I swear to god I have had less problematic Bugs in Unity
unfortunately i can't run your app to test this since it's reliant on your database
It's just a basic Microsoft SQL Server database
Running Locally
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
alright then, Will update
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
Yea I will, this is a really wierd crash
It used to work before I had to wipe my PC
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
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
oh, do you know what was broken with it?
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
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?
haven't checked, but rn for me getting this fixed is Priority
I need to meet my deadline dude
T_T
:PepeHands:
my condolences
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
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...
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
:thonking:
cool
computers are fun
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
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
This stuff is Beyond Human Comprehension
does the same code show the same behaviour on different browsers, on different operating systems, on different versions of .NET, etc
My Major is AI, I have seen Neural Networks more Explainable than this shit
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
yea anyway i am 99% sure it's the Browser
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
Replace the Browse with Drag and Drop, and for Download, well I just jerryrigged it for now