pnp / pnpframework

PnP Framework is a .NET library targeting Microsoft 365 containing the PnP Provisioning engine and a ton of other useful extensions
https://pnp.github.io/pnpframework/
MIT License
205 stars 143 forks source link

fix(auth): fix an issue where an asp.net application could potentially freeze when targetting a SharePoint On-premise environment #1030

Open nathan-swannet opened 3 months ago

nathan-swannet commented 3 months ago

In the ConfigureOnPremisesContext an event handler is registered containing an async function which is invoked with .GetAwaiter().GetResult(); This can and will freeze your whole asp.net application due to the nature of how the continuation of that task is done in this context.

Wrapping it in a Task.Run fixes this issue and ensures any exception are still thrown in the current synchronisation context.