Accounts count sets to 0 in MSAL, after the application auto update. (Windows)

Vaibhav Methuku 80 Reputation points


I hope this message finds you well. I am reaching out to report an issue I am encountering with MSAL authentication in my MAUI application, specifically related to the automatic update process using the embedded appinstaller.

Here is the scenario:

  1. Currently, I have version 1.0.0 of my MAUI application installed on my machine.
  2. Whenever an update is available on the server, the application automatically downloads and updates to the latest version.
  3. Let's say version 2.0.0 is available on the server, and my application updates successfully to this version.
  4. After the update to version 2.0.0, I can see the previously authenticated accounts within the application.
  5. However, upon closing and reopening the application after the update, the previously authenticated accounts are no longer visible.

This behavior is unexpected and disrupts the user experience, as users are required to log in again after each application update, even though they were previously authenticated.

I have followed the approach outlined in the Microsoft documentation on how to embed an appinstaller file for automatic updates, but it seems that the authentication state is not being preserved during the update process. []

Could you please assist me in resolving this issue? I would appreciate any guidance or suggestions on how to ensure that the MSAL authentication state is maintained across application updates.

Thank you for your attention to this matter. I look forward to your prompt response and assistance in resolving this issue.

User's image

I'm using this way for caching for windows.

if(Device.RuntimePlatform == Device.UWP)
	mPublicClientApplication = PublicClientApplicationBuilder.Create(options.ClientId)
													.WithRedirectUri(SpecialRedirectUri ?? $"msal{options.ClientId}://auth")


	private async Task AttachTokenCache(ITokenCache tokenCache)
		string CacheFilePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\abccache\\msalcache.bin";
		StorageCreationProperties storageProperties = new StorageCreationPropertiesBuilder("abccache", CacheFilePath).Build();

		MsalCacheHelper msalcachehelper = await MsalCacheHelper.CreateAsync(storageProperties);


Vaibhav Methuku.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,185 questions
{count} votes