In our UWP App when building the app with .NET Native tool chain activated, we get the following error:
Exception thrown: 'System.Exception' in Castle.Core.dll
An exception of type 'System.Exception' occurred in Castle.Core.dll but was not handled in user code
Method 'TypeBuilder.AddInterfaceImplementation(Type)' was not included in compilation, but was referenced in ClassEmitter..ctor(ModuleScope, string, Type, IEnumerable<Type>, TypeAttributes, bool). There may have been a missing assembly.
Our Default.rd.xml looks like this:
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
</Application>
</Directives>
I cannot figure out, what I have to add to the Default.rd.xml to make my app works also with the .NET Native tool chain activated.
We're using Castle.Core for method interception within our Autofac IOC in our UWP App.
Thanks for your help, Peter
UWP doesn't support
System.Reflection.Emit
. It might sometimes work in debug, but does not work in release with .NET Native compilation:After the
System.Reflection.Emit
NuGet package was delisted (temporarily), we (Castle) considered whether DynamicProxy should target .NET Framework and .NET Core directly, and never target .NET Standard, however the .NET team has recently added the emit API to .NET Standard officially, previously it was in the .NET Standard APIs by accident.