Using EmitBehaviors.WhenModified with null Arrays causes NullReferenceException
See original GitHub issueRepro on v3.0.1/Master:
var serializer = new ConfigurationContainer().Emit(EmitBehaviors.WhenModified).Create();
var xml = serializer.Serialize(new TestClass());
var deserialized = serializer.Deserialize<TestClass>(xml);
class TestClass
{
public string[] Array { get; set; }
}
I think this is because the array gets compared with System.Linq.Enumerable.SequenceEqual which ofcourse does not accept null arrays.
Thank you for the great library!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Getting NullReferenceException when trying to add a value ...
I'm having issues with this code. Everytime when it runs, it returns me the 'System.NullReferenceException'. // Clear out the Array of code ...
Read more >When Trying to access Custom Class array
Whenever I run this I get a NullReference error, The arrays are matched, Ive already checked the loaded data is valid, but still...
Read more >NullReferenceException Class (System)
This exception occurs if you assume that each element of the array must contain a non-null value, and the value of the array...
Read more >What is NullReferenceException in C#? - Code Maze
In C#, a NullReferenceException occurs when we try to access a variable whose value has not been set or has been set to...
Read more >An unconventional way of investigating a ...
I was trying to call a virtual method on a null reference; This caused a segmentation fault, which was caught by the runtime...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Issue-Label Bot is automatically applying the label
bug
to this issue, with a confidence of 0.99. Please mark this comment with 👍 or 👎 to give our bot feedback!Links: app homepage, dashboard and code for this bot.
Sweeet… it has now been deployed to NuGet: https://www.nuget.org/packages/ExtendedXmlSerializer/
Thank you for improving ExtendedXmlSerializer, @Levi--G!