MongoDB.Bson.BsonSerializationException: Element name '*' is not valid'.

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.8.1, 2.9.0
    • Component/s: None
    • None
    • Environment:
      Windows 10, C# 2.2
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When building my current project for the first few attempts it worked perfectly. Now its saying MongoDB.Bson.BsonSerializationException: Element name 'UserClaims' is not valid'.

      Im storing a list of Claim(the default security claims provided by c#) heres the code:

      public List<Claim> UserClaims { get; set; {color:#89ddff}} = new List<Claim>();

       

      BsonClassMap.RegisterClassMap<Claim>(cm =>
      { cm.SetIgnoreExtraElements(true); cm.MapMember(c => c.Issuer); cm.MapMember(c => c.OriginalIssuer); cm.MapMember(c => c.Properties); cm.MapMember(c => c.Subject); cm.MapMember(c => c.Type); cm.MapMember(c => c.Value); cm.MapMember(c => c.ValueType); cm.MapCreator(c => new Claim(c.Type, c.Value, c.ValueType, c.Issuer, c.OriginalIssuer, c.Subject));{color:#89ddff}});

       
      I am registering a class map to deal with claims which i though would deal with it, it does but after a restart or so it stops working again. for example i switched from using List to using Array and it worked for a launch or two and then throw the error again. Any recomendations on how to deal with this? i can provide more code if required

       

            Assignee:
            Vincent Kam (Inactive)
            Reporter:
            john gray
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: