My Terminal outputs nothing
For some reason when I print an output from an Api or Nuget package it returns nothing.
11 Replies
I mean
Ah, I see the 2nd screenshot
Well, it's
async
And you're not await
ing it
So the code runs, but the app doesn't wait for it to be done running and just existsI'm actually stupid, sorry
Show your solution, we'll see 😛
i just removed the await from the code and it worked
it was just meant to be a quick package test
so everything was kinda hacky
Uh, yeah, do not remove it
.Result
is the hacky way if anything
What you want is make GetMetadata
method async Task
instead of async void
Then make your Main
method async Task
instead of void
And add await
to your GetMetadata()
callohhh!!!
i genuinely didn't think of that
I forgot the main method doesn't have to be void
I was gonna ask this question on stack overflow but I'm happy I asked it here instead cause I woulda gotten pumbled
To be more precise, the main method can be either
void
, int
, async Task
, or async Task<int>
https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/main-command-line#main-return-valuesthanks