Getting "Operation is not valid due to the current state of the object" error

Problem:

When SharePoint is configured with Trusted Identity provider, you might get a error "Operation is not valid due to the current state of the object" while accessing the page after a successful authentication.

Error is :

Microsoft.SharePoint.IdentityModel.SPFederationAuthenticationModule.GetReturnUrlFromResponse Operation is not valid due to the current state of the object

Root cause

One of the root cause is the Identifier Claim coming from AD FS is empty. If you have configured with AD, then go to AD and give the proper value in AD Attribute.