This repository was archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Handle binary formatted payloads with ResX mangled generic type names #42102
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ResXSerializationBinder on desktop corrupted type names for generic parameters in the binary formatted payload. It would also undo this in the reader, but we don't benefit from that in .NETCore since we don't deserialize during build: we just copy the preserialized payload into the resources. To handle this, we use a serialization binder to un-mangle the type names in a way similar to ResXSerializationBinder. We do it slightly differently so that we only do it when needed, since relying on the binder to resolve the type bypasses the type cache in BinaryFormatter.
tarekgh
reviewed
Oct 25, 2019
src/System.Resources.Extensions/src/System/Resources/Extensions/PreserializedResourceWriter.cs
Show resolved
Hide resolved
tarekgh
reviewed
Oct 25, 2019
src/System.Resources.Extensions/src/System/Resources/Extensions/DeserializingResourceReader.cs
Outdated
Show resolved
Hide resolved
tarekgh
reviewed
Oct 25, 2019
src/System.Resources.Extensions/src/System/Resources/Extensions/DeserializingResourceReader.cs
Show resolved
Hide resolved
tarekgh
reviewed
Oct 25, 2019
src/System.Resources.Extensions/src/System/Resources/Extensions/DeserializingResourceReader.cs
Show resolved
Hide resolved
tarekgh
approved these changes
Oct 25, 2019
stephentoub
reviewed
Oct 25, 2019
src/System.Resources.Extensions/src/System/Resources/Extensions/DeserializingResourceReader.cs
Outdated
Show resolved
Hide resolved
stephentoub
approved these changes
Oct 25, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me. I notice you're targeting master
; what is the ship vehicle for this? It would also be needed for the desktop-application-using-S.R.Exts-built-with-Core scenario, right?
src/System.Resources.Extensions/src/System/Resources/Extensions/DeserializingResourceReader.cs
Outdated
Show resolved
Hide resolved
All our changes go into master first and we cherry-pick to release. I plan to bring this up in 3.1 ask mode. |
Tested this by patching both MSBuild and WindowsDesktop shared framework with the fix and it addressed the issue. |
ericstj
added a commit
to ericstj/corefx
that referenced
this pull request
Oct 29, 2019
…dotnet#42102) * Handle binary formatted payloads with ResX mangled generic type names ResXSerializationBinder on desktop corrupted type names for generic parameters in the binary formatted payload. It would also undo this in the reader, but we don't benefit from that in .NETCore since we don't deserialize during build: we just copy the preserialized payload into the resources. To handle this, we use a serialization binder to un-mangle the type names in a way similar to ResXSerializationBinder. We do it slightly differently so that we only do it when needed, since relying on the binder to resolve the type bypasses the type cache in BinaryFormatter. * Respond to feedback. release/3.1 - regenerate TestData.resources
ericstj
added a commit
that referenced
this pull request
Oct 30, 2019
…#42102) (#42209) * Handle binary formatted payloads with ResX mangled generic type names ResXSerializationBinder on desktop corrupted type names for generic parameters in the binary formatted payload. It would also undo this in the reader, but we don't benefit from that in .NETCore since we don't deserialize during build: we just copy the preserialized payload into the resources. To handle this, we use a serialization binder to un-mangle the type names in a way similar to ResXSerializationBinder. We do it slightly differently so that we only do it when needed, since relying on the binder to resolve the type bypasses the type cache in BinaryFormatter. * Respond to feedback. release/3.1 - regenerate TestData.resources
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
…dotnet/corefx#42102) * Handle binary formatted payloads with ResX mangled generic type names ResXSerializationBinder on desktop corrupted type names for generic parameters in the binary formatted payload. It would also undo this in the reader, but we don't benefit from that in .NETCore since we don't deserialize during build: we just copy the preserialized payload into the resources. To handle this, we use a serialization binder to un-mangle the type names in a way similar to ResXSerializationBinder. We do it slightly differently so that we only do it when needed, since relying on the binder to resolve the type bypasses the type cache in BinaryFormatter. * Respond to feedback. Commit migrated from dotnet/corefx@feebf02
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ResXSerializationBinder on desktop corrupted type names for generic parameters
in the binary formatted payload. It would also undo this in the reader,
but we don't benefit from that in .NETCore since we don't deserialize
during build: we just copy the preserialized payload into the resources.
To handle this, we use a serialization binder to un-mangle the type names
in a way similar to ResXSerializationBinder. We do it slightly differently
so that we only do it when needed, since relying on the binder to resolve
the type bypasses the type cache in BinaryFormatter.