✅ Awaiting a method exits program
I don't why but awaiting this method will result in the code exiting with only ever reaching Checkpoint A. While this has let me to believe that there was some error in the method I'm calling I added a debug message. This debug message is also never displayed before the program exits. Same applies when creating a list of tasks and awaiting them with Task.WhenAll().
Is there anything super simple I'm missing?
26 Replies
Use the debugger. Sounds like there is an exception being thrown
$debug
Tutorial: Debug C# code - Visual Studio (Windows)
Learn features of the Visual Studio debugger and how to start the debugger, step through code, and inspect data in a C# application.
That is the weird part though. No exception thrown. It just exits out and never calls the method its supposed to
There is probably an exception being thrown. Debug->Windows->Exceptions, check the box for all managed exceptions, and try again
You mean this?
Still no exception thrown with these changes
you probably aren't awaiting the task of the method that this code is in
try doing a try catch around that scraper and you'll see the exception
Still no luck with this
That is kinda pointless
It is, but it was upon the suggestion
You'll need to show more code
Was about to
Particularly the entire async stack
Please no async void
It isnt 😅
This is the method in Question.
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
If your code is too long, post it to: https://paste.mod.gg/and this is the main stack. cant use the code format as its to long
Then use a paste site
ok sure
Pastebin
Main: private static async void RunScraper() { //Called RunScra...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
It is ugly code still but I'll save refactoring for last
async void...
First thing I see is async void
You been telling porkies
I need to head out for a bit
bruh. Youre so right
i am awaiting it in main but it obvously doesnt do anything
Yup
You can't await it
async Task, yes
well huuuuge thanks to you.
That might be the dumbest mistake I ever got stuck on for a whole day
Closing the threat then. Have a great day