Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have code that exists in both a .NET Framework 4.7.1 solution and in a .NET 5 solution. Although the serialization code works fine in .NET Framework 4.7.1, the constructor for the XmlSerializer throws a KeyNotFoundException on an enum from one of the data types being serialized. The strange thing is that although the enum type name is "eRefAngle", the exception says that "The given key 'eRefAngleValues1' was not present in the dictionary".

There are no Dictionary data types in the types to be serialized, so this is very odd.

By the way, I have come here because I have grown tired of the rudeness on Stack Overflow.

What I have tried:

I have created a separate .NET 5 project that includes only the source necessary to replicate the problem. I included only the source from the .NET Framework solution so that I can confirm that it is a .NET 5 problem only.

I'd have to share the test project somehow in order for somebody to see what is happening.
Posted
Updated 20-Jul-22 20:05pm
v2
Comments
Jeff Huckins 2021 20-Jul-22 14:57pm    
I just found the issue on GitHub: https://github.com/dotnet/runtime/issues/43675

There is no fix currently for .NET 5. The .NET core team only fixed it in .NET 6.
Richard Deeming 22-Jul-22 6:07am    
NB: .NET 5 went "end-of-life" back in May, so it's unlikely the issue will ever be fixed there:
.NET and .NET Core official support policy[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900