Skip to content
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

Use Assembly.Load as first option to load TempAssembly. #52429

Conversation

StephenMolloy
Copy link
Member

@StephenMolloy StephenMolloy commented May 7, 2021

Serialization: Use Assembly.Load() as first option for loading TempAssembly.

Years ago, Assembly.Load() was apparently not working correctly for the .Net
Core port of serialization, so a hacky workaround of building a filename and
loading an assembly by filename instead was used. This PR brings back the
Assembly.Load() behavior used in NetFx as the primary option, but keeps
the filename workaround as a backup since it's been in place in .Net Core
since 2017.

Fix #1403

@@ -139,7 +139,7 @@ internal void InitAssemblyMethods(XmlMapping[] xmlMappings)
/// </devdoc>
// SxS: This method does not take any resource name and does not expose any resources to the caller.
// It's OK to suppress the SxS warning.
[RequiresUnreferencedCode("calls LoadFile")]
[RequiresUnreferencedCode("calls LoadFrom")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still calls LoadFile, not LoadFrom

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It used to call both. Now it only calls LoadFrom. The call to LoadFile has moved to the new method below.

@StephenMolloy StephenMolloy force-pushed the Ser-TempAssembly.LoadGeneratedAssembly-RevertToLoad branch from ad3c016 to a48739a Compare May 20, 2021 07:25
@StephenMolloy StephenMolloy merged commit e2f5c11 into dotnet:main May 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Load instead of LoadFile when load pregenerated xmlserializer
4 participants