I have been developing an App for the windows store UWP Windows 10. In debug mode with "Compile with .NET Native tool chain" turned off.
Now its time to build the release and upload to the store and I get the following compilation error.
1>MSBUILD : error : System.NotSupportedException: Cannot deserialize type 'System.Exception' because it contains property 'HResult' which has no public setter.
1>MSBUILD : error : at System.Xml.Serialization.TypeDesc.CheckSupported()
1>MSBUILD : error : at System.Xml.Serialization.TypeDesc.CheckSupported()
1>MSBUILD : error : at System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError)
1>MSBUILD : error : at System.Xml.Serialization.ReflectionAwareCodeGen.WriteReflectionInit(TypeScope scope)
1>MSBUILD : error : at System.Xml.Serialization.XmlSerializationWriterCodeGen.GenerateBegin()
1>MSBUILD : error : at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Hashtable assemblies, String outputDir, String assemblyNameBase, IEnumerable 1 referenceDirectories, String intermediateDir, Boolean loadAssembly)
1>MSBUILD : error : ILT0032: Failed to compile serialization code. See the build log for error details.
1>MSBUILD : error : at System.Xml.Serialization.XmlSerializer.GenerateSerializer(Type[] types, XmlMapping[] mappings, CompilerParameters parameters, String outputDir, String assemblyNameBase, IEnumerable 1 referenceDirectories, String intermediateDir, Boolean loadAssembly)
1>MSBUILD : error : at System.Xml.Serialization.XmlSerializer.GenerateSerializer(Type[] types, String outputDir, String assemblyNameBase, IEnumerable 1 referenceDirectories, String intermediateDir, List 1 wcfSerializers, Boolean loadAssembly)
1> Done executing task "RunILTransforms" -- FAILED.
1> Done building target "RunILTransforms" in file "ILTransforms" -- FAILED.
1> Done building project "ILTransforms" -- FAILED.
1>MSBUILD : error : at SerializationAssemblyGenerator.Program.Main(String[] args) C:\Users\user.nuget\packages\microsoft.net.native.compiler\2.0.3\tools\Microsoft.NetNative.targets(741,5): error MSB3073:
The command C:\Users\user.nuget\packages\microsoft.net.native.compiler\2.0.3\tools\x86\ilc\ilc.exe @obj\x86\Release\ilc.MyApp.rsp /v:diag" exited with code 1201.
I am using XML and JSON Serialisation and Deserialisation in my code but it all seems correct.
The issue seems to be with the 'System.Exception' and its property 'HResult' which upon inspection seems to have a protected setter preventing deserialisation.
Any help in solving this would be fantastic.