Solution: Visual Studio: We could not refresh the credentials for the account MSAL V3 Deserialization failed to parse the cache contents.

I ran into this error yesterday, not sure how I got Visual Studio into this state, but I thought I would post a quick fix - just in case you run into the same issue. So you know, I have reported this to the Visual Studio team and am helping them figure out what is going on so we can get a better fix out there.

Here’s the full text of the exception message:

We could not refresh the credentials for the account MSAL V3 Deserialization failed to parse the cache contents. 

Is this possibly an earlier format needed for DeserializeMsalV2? 

(See https://aka.ms/msal-net-3x-cache-breaking-change)

Here’s a screenshot of the exception message:
"VS error message"

This was preventing me from logging into Visual Studio and if I didn’t have some internal Microsoft information, I would have never known how to figure out a solution.

But, because I’ve be working with Microsoft dev tools quite a bit, I know that dev tool credentials are encrypted and stored in this file:

%LOCALAPPDATA%\.IdentityService\msal.cache

I backed up the file, deleted the original, restarted Visual Studio, and it worked.

Solution

  1. Go to %LOCALAPPDATA%\.IdentityService\, just enter that into Windows Explorer navigation bar and hit enter.

  2. Find the msal.cache file

'msal.cache file'

  1. Create a backup copy (not required, but do this if you want to keep it for some reason)

  2. Delete the file.

  3. Restart Visual Studio

That should resolve this issue.

Please leave a comment below if you run into this issue and if this solution didn’t work for you.

Jon