You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When hosting .NET Core in a native application, Assembly.GetEntryAssembly() returns null. The System.Xml.Serialization.TempAssembly.LoadGeneratedAssembly(Type, string, out XmlSerializerImplementation) method is not prepared for this and throws NullReferenceException.
Looks to me like this was assuming GetEntryAssembly() would never return null, but it does in this case as mentioned here: #25027 (comment)
A fix for this would be to handle null, and fall back to something like AppContext.BaseDirectory instead. Perhaps just replace this with AppContext.BaseDirectory.
Looks like this was already fixed by #40598. But #52429 also reworks this area of code to improve experiences here. Either way, I believe this issue has been addressed.
When hosting .NET Core in a native application,
Assembly.GetEntryAssembly()
returnsnull
. TheSystem.Xml.Serialization.TempAssembly.LoadGeneratedAssembly(Type, string, out XmlSerializerImplementation)
method is not prepared for this and throwsNullReferenceException
.runtime/src/libraries/System.Private.Xml/src/System/Xml/Serialization/Compilation.cs
Line 167 in 7c24ebc
The text was updated successfully, but these errors were encountered: