question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using EmitBehaviors.WhenModified with null Arrays causes NullReferenceException

See original GitHub issue

Repro 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
issue-label-bot[bot]commented, Dec 9, 2019

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.

1reaction
Mike-E-angelocommented, Dec 10, 2019

Sweeet… it has now been deployed to NuGet: https://www.nuget.org/packages/ExtendedXmlSerializer/

Thank you for improving ExtendedXmlSerializer, @Levi--G!

<div>ExtendedXmlSerializer 3.0.2</div><div>An extensible Xml Serializer for .NET that builds on the functionality of the classic XmlSerializer with a powerful and robust extension model.</div>
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found