2
votes

I've been trying to compile my app using the .NET Native toolchain for days and I still didn't manage to get it working.

If I try to compile it without using the .NET Native option (so in Debug mode), everything works just fine and the app is compiled and runs as expected.

But, whenever I try to compile it in release mode, as soon as the .NET Native process kicks in, I get the following errors:

1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : System.InvalidOperationException: Unable to generate a temporary class (result=1).

1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : error CS0012: The Type 'Windows.UI.Xaml.DependencyObject' is defined in an assembly that is not referenced. Add a reference to the assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.

1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : error CS0012: The Type 'Windows.UI.Xaml.Data.IValueConverter' is defined in an assembly that is not referenced. Add a reference to the assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.

1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : error CS0012: The Type 'Windows.UI.Xaml.Markup.IXamlMetadataProvider' is defined in an assembly that is not referenced. Add a reference to the assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.

1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error :

1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in System.Xml.Serialization.Compiler.Compile(String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence, String outputDir, String intermediateDir, Boolean loadAssembly)

1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Hashtable assemblies, String outputDir, String intermediateDir, Boolean loadAssembly)

1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in System.Xml.Serialization.XmlSerializer.GenerateSerializer(Type[] types, XmlMapping[] mappings, CompilerParameters parameters, String outputDir, String intermediateDir, Boolean loadAssembly)

1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in System.Xml.Serialization.XmlSerializer.GenerateSerializer(Type[] types, String outputDir, String intermediateDir, List`1 wcfSerializers, Boolean loadAssembly)

1>C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(886,5): error : in SerializationAssemblyGenerator.Program.Main(String[] args)

I tried to find something on Google, but without results.

I really don't know if I'm doing something wrong here or if there's something I can do to fix this. As I said, when I compile the project in debug mode, without the .NET Native, everything is fine.

Thank you for your help!

1
The build step that fails does entirely too much work and the exception is entirely too vague to diagnose the underlying problem. It is not even clear if it is caused by an install issue, the platform target or specific to your project. You must create a minimum repro of this problem so other SO users can reproduce the failure. If you don't want to take the time then call Microsoft Support for assistance. - Hans Passant
@HansPassant The project is too big right now and I really wouldn't know where to start to replicate the issue. I hoped other users got the same errors as well. It's strange though, I didn't use the XmlSerializer in my project, I only used the DataContractSerializer as I read it's better supported by the .NET Native compiler. And as for those missing references, I really don't know what's that supposed to mean, the standard compiler works perfectly so I don't see any missing references here... Looks like the .NET Native compiler is messing things up here :( - Sergio0694

1 Answers

1
votes

This is most likely caused by a *.rd.xml file in your application or set of libraries that is being too inclusive. Look for overly broad uses of XmlSerialize ex:

Most likely, you don't actually need to serialize EVERYTHING in MyAssembly and those kinds of broad inclusions make it much more likely that the serialization generator with choke and crash.