Sergio0694
Sergio0694

Reputation: 4567

.NET Native compiler keeps throwing compilation errors

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!

Upvotes: 2

Views: 1420

Answers (1)

MattWhilden
MattWhilden

Reputation: 1696

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.

Upvotes: 1

Related Questions