.NET SDK v25.2.0 and 26.0.0 freeze/lock IIS/VS

@pauld

In regards to the sample application code and why the code is freezing. This is because the DotNet-Framework v4.8 has an issue with the synchronization context that needs an intermediate Task to generate a new context to handle exceptions.

When wait() is called on the main thread, the work inside the async function is executed on the same main thread. As a result, there is no available main thread to catch an exception. To address this, you can utilize another task, Task.Run() to encapsulate the work. This way, the responsibility will be shifted to the new Task context.

This line can be updated as so, and it should fix the code from freezing up
Task.Run(RetrieveLocationsAsync).Wait();

It’s also important to note that .NET Core does not have a synchronization context, so you won’t encounter this deadlock issue with .NET Core.

Let me know if you have further questions or if that is not working