UnityIonicIntegration icon indicating copy to clipboard operation
UnityIonicIntegration copied to clipboard

Various il2cpp and mscorlib errors

Open Caratroc opened this issue 5 years ago • 10 comments

Hello,

I’m currently trying to build an empty unity project and a blank Ionic project on ios following your guide. I have followed every step multiple times with different projects from scratch. I am practically a beginner in all the ionic/web/html side for the record, so maybe i’m missing something obvious. The ionic project works on its own when built and run from xcode or CLI. The unity project works on its own as well. After following the iOS steps, though, various errors start coming but seem all related to il2cpp and mscorlib.

Software used : Unity 2017.4 and 2018.3 Ionic 4 and 3 Angular : Latest

extern "C" IL2CPP_METHOD_ATTR int32_t MonoCMethod_get_core_clr_security_level_m1431438660 (MonoCMethod_t3191134373 * __this, const RuntimeMethod* method)
{
	typedef int32_t (*MonoCMethod_get_core_clr_security_level_m1431438660_ftn) (MonoCMethod_t3191134373 *);
	using namespace il2cpp::icalls;
	return  ((MonoCMethod_get_core_clr_security_level_m1431438660_ftn)mscorlib::System::Reflection::MonoCMethod::get_core_clr_security_level) (__this);
}

mscorlib::System::Reflection::MonoCMethod::get_core_clr_security_level

No member named 'get_core_clr_security_level' in 'il2cpp::icalls::mscorlib::System::Reflection::MonoCMethod'

extern "C" IL2CPP_METHOD_ATTR void CustomAttributeData_ResolveArgumentsInternal_m4232068489 (RuntimeObject * __this /* static, unused */, ConstructorInfo_t5769829 * ___ctor0, Assembly_t * ___assembly1, intptr_t ___data2, uint32_t ___data_length3, ObjectU5BU5D_t2843939325** ___ctorArgs4, ObjectU5BU5D_t2843939325** ___namedArgs5, const RuntimeMethod* method)
{
	typedef void (*CustomAttributeData_ResolveArgumentsInternal_m4232068489_ftn) (ConstructorInfo_t5769829 *, Assembly_t *, intptr_t, uint32_t, ObjectU5BU5D_t2843939325**, ObjectU5BU5D_t2843939325**);
	using namespace il2cpp::icalls;
	 ((CustomAttributeData_ResolveArgumentsInternal_m4232068489_ftn)mscorlib::System::Reflection::CustomAttributeData::ResolveArgumentsInternal) (___ctor0, ___assembly1, ___data2, ___data_length3, ___ctorArgs4, ___namedArgs5);
}

mscorlib::System::Reflection::CustomAttributeData::ResolveArgumentsInternal

No member named 'CustomAttributeData' in namespace 'il2cpp::icalls::mscorlib::System::Reflection'; did you mean 'CustomAttributesCache'? Replace 'mscorlib::System::Reflection::CustomAttributeData' with 'CustomAttributesCache' No member named 'ResolveArgumentsInternal' in 'CustomAttributesCache'

and 6 other similar errors, not sure if it's useful to paste them. screen shot 2019-03-01 at 13 54 37

If you have any question or suggestion I would be extremely thankful !

Caratroc avatar Mar 01 '19 12:03 Caratroc

Does the same issue occur on a fresh new Unity project's build? Are you using some tool that obfuscates your code?

yasirkula avatar Mar 01 '19 15:03 yasirkula

Yes same issue with a new project. I just put the IonicComms.cs in and uIonicComms.mm in the plugin/ios folder. No obfuscating code. Thanks for the quick answer.

Caratroc avatar Mar 01 '19 15:03 Caratroc

I can't think of any reasons for this behavior, sorry :/

yasirkula avatar Mar 02 '19 12:03 yasirkula

Well, thanks a lot anyway. I will update when I solve this :)

Caratroc avatar Mar 04 '19 08:03 Caratroc

Any update on this? getting similar mscorlib compiler problems: [...]Classes/Native/Bulk_mscorlib_15.cpp:18759:114: No member named 'EncodingHelper' in namespace 'il2cpp::icalls::mscorlib::System::Text' and a bunch more too.

Building with Unity 2018.3.5f1

I will also update if I find anything new.

lfwells avatar Mar 10 '19 01:03 lfwells

Curiously, the class members it is looking for in my error message there do exist inside Unity/Libraries/libil2cpp/include/icalls/mscorlib/... However they're wrapped up in #if NET_4_0, so they're not found.

Still poking around trying to get it to compile (I'm out of my depth here), but the members are clearly found if NET_4_0 is defined as true, and the compiler error goes away.

Not sure where the root cause is yet though, surely NET_4_0 should be defined somewhere?

lfwells avatar Mar 10 '19 01:03 lfwells

I added NET_4_0 as a preprocessor Macro under target build settings. I've gotten it to compile now (I think I had some other problems unrelated (?) to this one. Unfortunately get a crash when trying to launch unity now, but honestly not surprised given how much I've hacked at this. Will report back if I learn anything.

lfwells avatar Mar 10 '19 02:03 lfwells

You may try changing Scripting Runtime Version and/or Api Compatibility Level in Player Settings.

yasirkula avatar Mar 10 '19 07:03 yasirkula

I believe I was compiling with Net 4 for all of this, but I still had to add the NET_4_0 preprocessor directive manually in Xcode. No idea why :) I got rid of my crashing using the advice in this thread: https://forum.unity.com/threads/il2cpp-anyone-else-seeing-metadatacache-initialize-crashes-sometimes-when-the-game-starts.383145/page-2 Again, unsure if related to this issue or if I was just getting multiple issues at once here.

lfwells avatar Mar 10 '19 08:03 lfwells

@lfwells - you posted this so long time ago and the same is happening to me now. I solved everything except the crash. Not sure which was the advice you followed (there are a couple, both did not work for me) and how you finally solved.

zoix avatar Aug 19 '19 23:08 zoix