XmlSerializer formatter = new XmlSerializer(typeof(List<T>)) throws exception

75 views Asked by At

I am using excel-dna to create an excel ribbon. I am saving the user settings using the xml serializer.

XmlSerializer formatter = new XmlSerializer(typeof(List<Config>));

this line of code was working in .net framework 4.7.2 migrated to .net 6 and it throws exception: "a non-collectible assembly may not reference a collectible assembly."

when I debug, I see that it is not able to find system.private.corelib.xmlserializers.dll in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.16

I tried assign extra attibutes in the custom type Config. I tried to passing in additional parameters in the serializer, such as additional type Config and xmlroot attribute. It has made no difference.

0

There are 0 answers