System.Xml.XmlSerializer 4.3.0 does not longer work with IEnumerable, prior versions did
I am working with @ellismg that has pushed my code into "bleeding" edge. At present, I'm building against NETStandard.Library 1.6.0, Microsoft.Net.Sdk 1.0.0-alpha-20161104-2, and, among other dependencies, System.Xml.XmlSerializer 4.3.0.
My code now gets the following error deserializing that did not occur with System.Xml.XmlSerializer 4.0.11-* (note the bold):
Exception occurred during start: HttpException: Uri(http://168.63.129.16/machine/1fb6fde7-d516-4ccf-b134-929f12f4d7e7/357c0978-2bd4-4547-9e8c-4557e73ed12c._u1404?comp=config&type=hostingEnvironmentConfig&incarnation=3) Method(GET) StatusCode(OK) Message(HttpRequest#FromXml failed) InnerExceptions(There was an error reflecting type 'Microsoft.Azure.Agent.Protocol.HostingEnvironmentConfig'.; There was an error reflecting property 'HostingEnvironmentSettings'.; There was an error reflecting type 'Microsoft.Azure.Agent.Protocol.HostingEnvironmentConfigHostingEnvironmentSettings'.; To be XML serializable, types which inherit from IEnumerable must have an implementation of Add(System.Object) at all levels of their inheritance hierarchy. System.Xml.XmlElement does not implement Add(System.Object).)
There's a bit of additional wackiness going on here, that may be relevant. All of @brendandixon's libraries are built using NETStandard.Library 1.6.0, but the actual application that consumes these libraries is using the nightly newer version of Microsoft.NETCore.App:
In the library project, we have these references:
<ItemGroup>
<PackageReference Include="NETStandard.Library">
<Version>1.6.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161104-2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Xml.XmlDocument">
<Version>4.3.0</Version>
</PackageReference>
</ItemGroup>
In the runable application's csproj we have the following:
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.2.0-beta-001276-00</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Sdk">
<Version>1.0.0-alpha-20161104-2</Version>
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="System.IO.FileSystem.DriveInfo">
<Version>4.4.0-beta-24904-01</Version>
</PackageReference>
<!-- This package reference lifts the version of System.Xml.XmlSerializer which is brought in
transitively due to our ProjectReference's dependencies. This is needed because the newer
version of some assemblies pulled in by the beta version of Microsoft.NETCore.App are not
compatibile with the older (4.3.0) version -->
<PackageReference Include="System.Xml.XmlSerializer">
<Version>4.4.0-beta-24904-01</Version>
</PackageReference>
</ItemGroup>
If we should instead be using a corresponding daily version of NETStandard.Library in the library projects we can do that.
@ellismg I am starting a test using NETStandard.Library 1.6.2-beta-24905-02. I'll update as appropriate.
It may be best to make sure the pre-release specifier is consistent across the project (e.g use 24904-01 as we do in the package reference in the app's .csproj). Otherwise NuGet may complain about package downgrades.
@ellismg I am going to close this. Moving forward, plus some clean-up with my Docker container, has resolved the issue.