I am trying to run this code in console application to understand how exactly works try-finally
try
{
Console.WriteLine("Message");
throw new Exception("Error");
}
finally
{
Console.WriteLine("Final");
}
I tested this on my PC and by notebook, but the results were different. On my notebook I get console output "Message", then error stack trace, then "Final". On my PC the consequence is the same, but without "Final". My notebook is on Windows 11, while my PC is on Windows 10. NET version is 7.
I am already tryed to run compiled programs in both cases, but that makes no difference. Also I am not getting "Final" in notebook when run code with debug breaks on every line in Visual Studio 2022. Any suggestions why this happens and how can I fix/set up the behavior of try finally?.