Retrofit4Unity icon indicating copy to clipboard operation
Retrofit4Unity copied to clipboard

NotSupportedException with .net4x il2cpp backend

Open unktomi opened this issue 7 years ago • 3 comments

NotSupportedException: System.AppDomain::DefineDynamicAssembly at System.AppDomain.DefineDynamicAssembly (System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAcces\ s access) [0x00000] in <00000000000000000000000000000000>:0 at Castle.DynamicProxy.ModuleScope.CreateModule (System.Boolean signStrongName) [0x00000] in <00000000000000000000000000000\ 000>:0 at Castle.DynamicProxy.ModuleScope.ObtainDynamicModuleWithWeakName () [0x00000] in <00000000000000000000000000000000>:0 at Castle.DynamicProxy.ModuleScope.ObtainDynamicModule (System.Boolean isStrongNamed) [0x00000] in <00000000000000000000000\ 000000000>:0 at Castle.DynamicProxy.ModuleScope.DefineType (System.Boolean inSignedModulePreferably, System.String name, System.Reflecti\ on.TypeAttributes flags) [0x00000] in <00000000000000000000000000000000>:0 at Castle.DynamicProxy.Generators.Emitters.ClassEmitter.CreateTypeBuilder (Castle.DynamicProxy.ModuleScope modulescope, Sys\ tem.String name, System.Type baseType, System.Collections.Generic.IEnumerable1[T] interfaces, System.Reflection.TypeAttribut\ es flags, System.Boolean forceUnsigned) [0x00000] in <00000000000000000000000000000000>:0 at Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor (Castle.DynamicProxy.ModuleScope modulescope, System.String n\ ame, System.Type baseType, System.Collections.Generic.IEnumerable1[T] interfaces, System.Reflection.TypeAttributes flags, Sy\ stem.Boolean forceUnsigned) [0x00000] in <00000000000000000000000000000000>:0 at Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor (Castle.DynamicProxy.ModuleScope modulescope, System.String n\ ame, System.Type baseType, System.Collections.Generic.IEnumerable1[T] interfaces) [0x00000] in <0000000000000000000000000000\ 0000>:0 at Castle.DynamicProxy.Generators.BaseProxyGenerator.BuildClassEmitter (System.String typeName, System.Type parentType, Sys\ tem.Collections.Generic.IEnumerable1[T] interfaces) [0x00000] in <00000000000000000000000000000000>:0 at Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.Init (System.String typeName, Castle.DynamicProxy.Gener\ ators.Emitters.ClassEmitter& emitter, System.Type proxyTargetType, Castle.DynamicProxy.Generators.Emitters.SimpleAST.FieldRef\ erence& interceptorsField, System.Collections.Generic.IEnumerable1[T] interfaces) [0x00000] in <0000000000000000000000000000\ 0000>:0 at Castle.DynamicProxy.Generators.InterfaceProxyWithoutTargetGenerator.GenerateType (System.String typeName, System.Type pr\ oxyTargetType, System.Type[] interfaces, Castle.DynamicProxy.Generators.INamingScope namingScope) [0x00000] in <0000000000000\ 0000000000000000000>:0 at Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator+<>c__DisplayClass6_0.b__0 (System.String \ n, Castle.DynamicProxy.Generators.INamingScope s) [0x00000] in <00000000000000000000000000000000>:0 at System.Func3[T1,T2,TResult].Invoke (T1 arg1, T2 arg2) [0x00000] in <00000000000000000000000000000000>:0 at Castle.DynamicProxy.Generators.BaseProxyGenerator.ObtainProxyType (Castle.DynamicProxy.Generators.CacheKey cacheKey, Sys\ tem.Func`3[T1,T2,TResult] factory) [0x00000] in <00000000000000000000000000000000>:0 at Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.GenerateCode (System.Type proxyTargetType, System.Type[\ ] interfaces, Castle.DynamicProxy.ProxyGenerationOptions options) [0x00000] in <00000000000000000000000000000000>:0 at Castle.DynamicProxy.DefaultProxyBuilder.CreateInterfaceProxyTypeWithoutTarget (System.Type interfaceToProxy, System.Type\ [] additionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options) [0x00000] in <000000000000000000000000000\ 00000>:0 at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyTypeWithoutTarget (System.Type interfaceToProxy, System.Type[] ad\ ditionalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options) [0x00000] in <00000000000000000000000000000000\ >:0 at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget (System.Type interfaceToProxy, System.Type[] additi\ onalInterfacesToProxy, Castle.DynamicProxy.ProxyGenerationOptions options, Castle.DynamicProxy.IInterceptor[] interceptors) [\ 0x00000] in <00000000000000000000000000000000>:0 at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget (System.Type interfaceToProxy, Castle.DynamicProxy.\ IInterceptor interceptor) [0x00000] in <00000000000000000000000000000000>:0 at Retrofit.RetrofitAdapter.Create[T] () [0x00000] in <00000000000000000000000000000000>:0

unktomi avatar Dec 15 '18 17:12 unktomi

Thx for report, I am working on it. Due to Unity doesn't support any usage of System.Relection.Emit when building for AOT(Ahead of Time) platform, which means any DynamicProxy libs like Castle.Core or System.Relection.DispatchProxy cant be used on IL2CPP Scripting backend. Currently I'd like to suggest u to use the way without runtime code generation, here is the example: '\Project\Assets\Retrofit4Unity\Demo\Scenes\RestAPIDemo.unity' And I'm also considering to make a Editor plugin for auto code generation to make retrofit more conveniently to use for AOT scenario.

sp958857 avatar Dec 21 '18 06:12 sp958857

Same problem when I use hotween in unity and then build a webgl package. Any idea?

chendind avatar Apr 10 '22 03:04 chendind

This AIRDROP IS A SCAM FROM A FKING SCAMMER BE AWARE

mtmtmt123 avatar Jan 01 '24 15:01 mtmtmt123