[NOT_REPRODUCIBLE] Mongo Serialization: IdentityUser

I have…

  • [x] Checked the logs and have uploaded a log file and provided a link because I found something suspicious there. Please do not post the log file in the topic because very often something important is missing.

I’m submitting a…

  • [ ] Regression (a behaviour that stopped working in a new release)
  • [x] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behaviour

Tried setting up a new docker instance, using Google OAuth.
Initial run is working fine and able to login and logout.
After restarting an running instance or restarting with an updated docker images, getting below error (Pasted at the end).

Expected behaviour

Instance should work fine with restart and updated images.

Minimal reproduction of the problem

Setup a new docker instance with Google Auth (haven’t tested with other authentication options), create a login with a gmail and restart instance.


  • [x] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: 5.3 (Faced same with other 5.x)


  • [x] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge


Below a sample error message, trimmed log file uploaded in OneDrive

   Unhandled exception. System.FormatException: An error occurred while deserializing the Logins property of class Squidex.Domain.Users.MongoDb.MongoUser: Element 'Principal' does not match any field or property of class Microsoft.AspNetCore.Identity.UserLoginInfo.
    ---> System.FormatException: Element 'Principal' does not match any field or property of class Microsoft.AspNetCore.Identity.UserLoginInfo.
      at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeClass(BsonDeserializationContext context)
      at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize[TValue](IBsonSerializer`1 serializer, BsonDeserializationContext context)
      at MongoDB.Bson.Serialization.Serializers.EnumerableSerializerBase`2.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.Serializers.SerializerBase`1.MongoDB.Bson.Serialization.IBsonSerializer.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
      at MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize(IBsonSerializer serializer, BsonDeserializationContext context)
      at MongoDB.Bson.Serialization.BsonClassMapSerializer`1.DeserializeMemberValue(BsonDeserializationContext context, BsonMemberMap memberMap)
      --- End of inner exception stack trace ---
      at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Execute(Expression expression)
      at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Execute[TResult](Expression expression)
      at System.Linq.Queryable.Any[TSource](IQueryable`1 source)
      at Squidex.Areas.IdentityServer.Config.CreateAdminHost.IsEmpty(UserManager`1 userManager) in /src/src/Squidex/Areas/IdentityServer/Config/CreateAdminHost.cs:line 102
      at Squidex.Areas.IdentityServer.Config.CreateAdminHost.StartAsync(ISemanticLog log, CancellationToken ct) in /src/src/Squidex/Areas/IdentityServer/Config/CreateAdminHost.cs:line 53
      at Squidex.Config.Startup.SafeHostedService.StartAsync(CancellationToken cancellationToken) in /src/src/Squidex/Config/Startup/SafeHostedService.cs:line 29
      at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
      at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
      at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
      at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
      at Squidex.Program.Main(String[] args) in /src/src/Squidex/Program.cs:line 24

Guessing to solve this problem might need to add ignore extra elements in MongoUserStore, Still exploring it. Will update request if I find any more information.


I think it was a temporary bug that is now fixed. If you have a look to your user object in mongodb your see extra information.

if you delete everything except these properties it should work fine: https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.userlogininfo?view=aspnetcore-3.1#properties

1 Like

Yeah, deleting extra properties is working fine.

Same issue is happening when trying with a new login.

Thank you for checking it.

PS: I’m using Squidex to learn DDD and Event Souring. Thank you for all your efforts :slight_smile:

What do you mean with “a new login”? I have not seen this issue in 5.3.0

Yes, it’s happening with 5.3 when creating new login account with Google Auth and next restart will have this error.

Not happening when using Username/Password.

I cannot reproduce this and I also do not see it in the code anymore.

I tried today with brand new setup in docker with 5.3, it is happening with only Google Auth. Working fine with Github and Microsoft Auth.

Thank you for checking.

I use google auth all the time and 5.3 is also deployed to the cloud where I don’t see it.

1 Like

Same error. To fix it, I removed additional extra fields.

Yeah, removing extra fields will fix it.