microsoft-authentication-library-for-dotnet
microsoft-authentication-library-for-dotnet copied to clipboard
[Bug] MSAL causes hangs in UWP app
In the Microsoft Partner Center I see "failures" reported as hangs for my Store-published app that seem to originate from MSAL:
0 | . | HANG_QUIESCE | 0x0000000000000000 |
---|---|---|---|
1 | unknown.dll | [.ecxr] | 0x0000000000000000 |
2 | Microsoft.Identity.Client.dll | Microsoft::Identity::Json::Linq::JObject.Load | 0x0000000000000000 |
3 | Microsoft.Identity.Client.dll | Microsoft::Identity::Json::Linq::JObject.Parse | 0x0000000000000000 |
4 | Microsoft.Identity.Client.dll | Microsoft::Identity::Client::Cache::Items::CacheSerializationContract.FromJsonString | 0x0000000000000000 |
5 | Microsoft.Identity.Client.dll | Microsoft::Identity::Client::Cache::TokenCacheJsonSerializer.Deserialize | 0x0000000000000000 |
6 | Microsoft.Identity.Client.dll | Microsoft::Identity::Client::TokenCache.Microsoft.Identity.Client.ITokenCacheSerializer.DeserializeMsalV3 | 0x0000000000000000 |
7 | Microsoft.Identity.Client.dll | Microsoft::Identity::Client::Platforms::uap::SynchronizedAndEncryptedFileProvider::_OnBeforeAccessAsync_d__6.MoveNext | 0x0000000000000000 |
8 | SharedLibrary.dll | System::Runtime::CompilerServices::AsyncMethodBuilderCore::MoveNextRunner::__c._CallMoveNext_b__3_0 | 0x0000000000000000 |
... | |||
23 | Microsoft.Identity.Client.dll | Microsoft::Identity::Client::Platforms::uap::SynchronizedAndEncryptedFileProvider::_ReadAndDecryptAsync_d__9.MoveNext | 0x0000000000000000 |
0 | . | HANG_QUIESCE | 0x0000000000000000 |
---|---|---|---|
1 | unknown.dll | [.ecxr] | 0x0000000000000000 |
2 | Microsoft.Identity.Client.dll | Microsoft::Identity::Json::JsonReader.SetToken | 0x0000000000000000 |
3 | Microsoft.Identity.Client.dll | Microsoft::Identity::Json::JsonTextReader.ParseValue | 0x0000000000000000 |
4 | Microsoft.Identity.Client.dll | Microsoft::Identity::Json::JsonTextReader.Read | 0x0000000000000000 |
5 | Microsoft.Identity.Client.dll | Microsoft::Identity::Json::Linq::JObject.Load | 0x0000000000000000 |
6 | Microsoft.Identity.Client.dll | Microsoft::Identity::Json::Linq::JObject.Parse | 0x0000000000000000 |
7 | Microsoft.Identity.Client.dll | Microsoft::Identity::Client::Cache::Items::CacheSerializationContract.FromJsonString | 0x0000000000000000 |
8 | Microsoft.Identity.Client.dll | Microsoft::Identity::Client::Cache::TokenCacheJsonSerializer.Deserialize | 0x0000000000000000 |
9 | Microsoft.Identity.Client.dll | Microsoft::Identity::Client::TokenCache.Microsoft.Identity.Client.ITokenCacheSerializer.DeserializeMsalV3 | 0x0000000000000000 |
10 | Microsoft.Identity.Client.dll | Microsoft::Identity::Client::Platforms::uap::SynchronizedAndEncryptedFileProvider::_OnBeforeAccessAsync_d__6.MoveNext | 0x0000000000000000 |
... | |||
26 | Microsoft.Identity.Client.dll | Microsoft::Identity::Client::Platforms::uap::SynchronizedAndEncryptedFileProvider::_ReadAndDecryptAsync_d__9.MoveNext | 0x0000000000000000 |
Not sure if that's relevant but the device this hang was reported from runs Windows 10.0.22621
Which version of MSAL.NET are you using? 4.44.0
Platform UWP, interactive auth flow
The stack trace seems to indicate a JSON deserialization failure that has to do with the cache. Is it possible to capture an error message or have any way to repro this?
I am not able to reproduce it and I don't know how Windows collects that information (or event determines when a hang is a hang). I don't even know if the user would have noticed something or if the method just was very slow. I was just surprised that working with JSON would cause a hang and I have found no indication that working with JSON in other parts of my apps would cause a hang
If cache serialization fails, MSAL will continue without it, storing the tokens in memory only. App should not be impacted. But when user restarts the app, they might have to re-login.
We are upgrading MSAL's UWP reference and internal JSON serialization in 4.45 (out soon). Would be intereseting to see if the problems continue to occur.
Won''t fix. Please upgrade to WinUI.