-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serializing a .Net Core ClaimsIdentity with claims causes PlatformNotSupportedException #1713
Comments
That looks like the expected behavior of |
did we get a resolution for this? |
Was this resolved? |
This issue has not been resolved. |
in .Net 5 this still is a problem |
Still a problem |
in .Net 6 this is still an issue
|
Annoyingly only solution seems to be to create DTOs |
Experiencing the same issue (net 7.0). What's the fix? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am in the process of upgrading my application to use .Net Core 2 and .NetStandard. In several areas I am serializing a
ClaimsIdentity
for logging and transmission purposes.Whenever I try to serialize a
ClaimsIdentity
that contains at least one claim, I get aPlatformNotSupportedException
. I suspect this is due to the Binary Serialization changes introduced in .Net Core 2 (https://github.com/dotnet/corefx/issues/23415). This appears to have been addressed previously (#1404) however I am still getting this error in 11.0.2.Using a decompiler, the error occurs in the
OnSerializingMethod
method inClaimsIdentity
, and only occurs when the identity has 1 or more claims attached:Source/destination types
Expected behavior
A fully serialized object with all claims intact.
Actual behavior
PlatformNotSupportedException: This instance contains state that cannot be serialized and deserialized on this platform.
Steps to reproduce
The text was updated successfully, but these errors were encountered: