I am seeing some weird behavior where the function call just returns to the calling function that too in the basic console app env – .net 8 using vs2022
the output of the code is
send1
main return
it skips –
send1.2 or exception
finally
send1 returned
any clues ?
public static async Task<int> Main(string[] args)
{
var url = "https://www.google.com";
send1(url);
Console.Writeline("main return");
return 1;
}
static void send1(string url)
{
try
{
using (HttpClient cli = new HttpClient())
{
cli.DefaultRequestHeaders.Accept.Clear();
dbg("send1");
HttpResponseMessage response1 = await cli.GetAsync(url);
dbg("send1.2");
}
}
catch(Exception ex)
{
Console.Writeline(ex.ToString());
}
finally
{
Console.Writeline("finally");
}
Console.Writeline("send1 returned");
}