Intermittently we see the following error when browsing a website:Collection was modified; enumeration operation may not execute.Exception type:System.InvalidOperationExceptionStackTrace:at System.Collections.Generic.List`1.Enumerator.MoveNextRare()at Microsoft.IdentityModel.Claims.ClaimCollection.CopyWithSubject(IClaimsIdentity subject)at Microsoft.IdentityModel.Claims.WindowsClaimsIdentity.Copy()at Microsoft.IdentityModel.Claims.WindowsClaimsPrincipal..ctor(WindowsClaimsIdentity identity)at Microsoft.IdentityModel.Claims.ClaimsPrincipal.CreateFromIdentity(IIdentity identity, String windowsIssuerName)at Microsoft.IdentityModel.Claims.ClaimsPrincipal.CreateFromIdentities(ClaimsIdentityCollection identities, String windowsIssuerName)at Microsoft.IdentityModel.Web.SessionAuthenticationModule.SetPrincipalFromSessionToken(SessionSecurityToken sessionSecurityToken)at Microsoft.IdentityModel.Web.SessionAuthenticationModule.AuthenticateSessionSecurityToken(SessionSecurityToken sessionToken, Boolean writeCookie)at Microsoft.IdentityModel.Web.SessionAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs eventArgs)at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)Note this error is occurring within Windows Identity Foundation itself, not our custom code. We do have a SessionSecurityTokenReceived event handler which modifies the claims collection and so I suspect that this is happening at the same time as the stack trace above is executing. However, I can't think of a scenario where both might happen at the same time. regardless, WIF should not error in this way.Would the fix be to use this._claims.ToList() rather than this._claims, in Microsoft.IdentityModel.Claims.ClaimCollection.CopyWithSubject().
Describe the problem that you're having.
What type of impact does this issue have?