-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Makes RemoteAuthenticationContext serialize correctly #53819
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
Conversation
the entire context is serialized for JSInterop and the State and InterativeRequest properties are lost during serialization this seems to be because the only usage is for serialization and the properties are compiled out
Thanks for your PR, @lewishazell. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Thanks for your PR, @lewishazell. |
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
Commenter does not have sufficient privileges for PR 53819 in repo dotnet/aspnetcore |
Thanks for the PR. I am going to close this in favor of #54225 because the type-level The reason that it appeared to work with the In #54225, I used cc @MichalStrehovsky @eerhardt to see if it makes sense to make class-level |
The purpose of these annotations is to make it possible to statically prove that some reflection done at runtime is safe. The fact that these annotations prevent things from being trimmed is secondary. Class-level I don't think there's a pattern that would allow us to prove something is trim-safe by simply keeping members on types that were kept (the proposed new semantic). It would only keep extra stuff, but there would still be trimming warnings at the point where this reflection is done. So no plans for extending the semantic to indiscriminately keeping members. |
@halter73 No problem, really glad it helped get to the root of the issue even if our fix isn't entirely correct. It was a difficult one to test for on our side. Will look over your PR with great interest. |
Makes RemoteAuthenticationContext serialize correctly
This PR ensures that
RemoteAuthenticationContext
property assignments are not optimized away when only used in serialization.Description
The entire context is serialized for
JSInterop
and theState
andInterativeRequest
properties are lost during serialization. This seems to be because the only usage is for serialization and the property assignments are compiled out.I think this may be the root cause of #53131, which I've also seen in our production application. The lack of the
State
property after serialization causes issues with the logout callback.The following code sample demonstrates this behaviour:
Which gives the following output in a browser:
Fixes #53131