Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

IL2APP ldvirtftn Runtime Error

Discussion in 'iOS and tvOS' started by John-Chen350, May 6, 2015.

  1. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    I don't know if it is fixed in 5.0.1p1 (677402) or not, since there are significant differences between that issue and mine. Also, since I'm mostly using my own class library (dll) instead of Assembly-CSharp in order to accelerate the compile speed, I'm not sure whether this fault belongs to me or not.

    On iPhone Simulator i've got the exception at:
    (Surely the exception is BAD_ACCESS which stands for NullReferenceException)

    Code (CSharp):
    1. Colosseum`il2cpp::vm::Runtime::GetVirtualInvokeData(MethodInfo*, void*) at Runtime.cpp:517:
    2. 0x31eea10:  pushl  %ebp
    3. 0x31eea11:  movl  %esp, %ebp
    4. 0x31eea13:  pushl  %esi
    5. 0x31eea14:  pushl  %eax
    6. 0x31eea15:  movl  0xc(%ebp), %eax
    7. 0x31eea18:  movl  0x8(%ebp), %ecx
    8. 0x31eea1b:  movl  (%eax), %edx
    9. 0x31eea1d:  movzwl 0x20(%ecx), %ecx
    10. 0x31eea21:  movl  0x34(%edx), %edx
    11. 0x31eea24:  movl  (%edx,%ecx,4), %esi
    12. 0x31eea27:  movl  0x8(%esi), %ecx
    which is referenced by:

    Code (CSharp):
    1. inline MethodInfo* GetVirtualMethodInfo (Il2CppCodeGenObject* pThis, MethodInfo* method)
    2. {
    3.     VirtualInvokeData data = il2cpp::vm::Runtime::GetVirtualInvokeData (method, pThis);
    4.     return data.methodInfo;
    5. }
    Finally here is my own code compiled by il2app.

    Code (CSharp):
    1. IL_0031:
    2.     {
    3.         ___Phase = G_B9_0;
    4.         Environment_t1268 * L_3 = ColosseumBehaviour_get_Environment_m7978(__this, /*hidden argument*/&ColosseumBehaviour_get_Environment_m7978_MethodInfo);
    5.         NullCheck(L_3);
    6.         CommandQueue_1_t1388 * L_4 = Environment_get_CommandQueue_m8077(L_3, /*hidden argument*/&Environment_get_CommandQueue_m8077_MethodInfo);
    7.         IntPtr_t83 L_5 = { GetVirtualMethodInfo(__this, &SceneSplash_PhaseIncrementInternal_m7309_MethodInfo) };
    8.         Action_2_t1570 * L_6 = (Action_2_t1570 *)il2cpp_codegen_object_new (InitializedTypeInfo(&Action_2_t1570_il2cpp_TypeInfo));
    9.         Action_2__ctor_m9261(L_6, __this, L_5, /*hidden argument*/&Action_2__ctor_m9261_MethodInfo);
    10.         GameObject_t28 * L_7 = Component_get_gameObject_m3307(__this, /*hidden argument*/&Component_get_gameObject_m3307_MethodInfo);
    11.         String_t* L_8 = Conversions_ToString_m6568(NULL /*static, unused*/, ___Phase, /*hidden argument*/&Conversions_ToString_m6568_MethodInfo);
    12.         NullCheck(L_4);
    13.         CommandQueue_1_ExecuteAction_m9262(L_4, L_6, L_7, L_8, /*hidden argument*/&CommandQueue_1_ExecuteAction_m9262_MethodInfo);
    14.         return;
    15.     }
    16. }
    17. // System.Void Colosseum.Clients.SceneSplash::PhaseIncrementInternal(UnityEngine.GameObject,System.String)
    18. void SceneSplash_PhaseIncrementInternal_m7309 (SceneSplash_t1277 * __this, GameObject_t28 * ___Source, String_t* ___Data, MethodInfo* method){
    19.     int32_t V_0 = 0;
    20.     bool V_1 = false;
    21.     {
    22.         int32_t L_0 = Int32_Parse_m4609(NULL /*static, unused*/, ___Data, /*hidden argument*/&Int32_Parse_m4609_MethodInfo);
    23.         V_0 = L_0;
    24.         ProgressTweener_t1266 * L_1 = (__this->___Slider_12);
    25.         int32_t L_2 = SceneSplash_get_TotalPhases_m7302(__this, /*hidden argument*/&SceneSplash_get_TotalPhases_m7302_MethodInfo);
    26.         NullCheck(L_1);
    27.         ProgressTweener_SetTarget_m7281(L_1, (((float)((double)((double)(((double)V_0))/(double)(((double)L_2)))))), /*hidden argument*/&ProgressTweener_SetTarget_m7281_MethodInfo);
    28.         int32_t L_3 = SceneSplash_get_TotalPhases_m7302(__this, /*hidden argument*/&SceneSplash_get_TotalPhases_m7302_MethodInfo);
    29.         V_1 = ((((int32_t)V_0) == ((int32_t)L_3))? 1 : 0);
    30.         if (!V_1)
    31.         {
    32.             goto IL_003d;
    33.         }
    34.     }
    35.     {
    36.         SplashTexts_t1282 * L_4 = (__this->___SplashTexts_8);
    37.         NullCheck(L_4);
    38.         Queue_1_t1283 * L_5 = SplashTexts_get_Texts_m7325(L_4, /*hidden argument*/&SplashTexts_get_Texts_m7325_MethodInfo);
    39.         NullCheck(L_5);
    40.         Queue_1_Clear_m9263(L_5, /*hidden argument*/&Queue_1_Clear_m9263_MethodInfo);
    41.     }
    42.  
    I've used ILSpy for its IL code and got the result as such:

    Code (CSharp):
    1. IL_0040: ldvirtftn instance void Colosseum.Clients.SceneSplash::PhaseIncrementInternal(class [UnityEngine]UnityEngine.GameObject, string)
    Thank you for reading, and I'm eager to know whether it's a known bug or not, since I didn't find any post concerning GetVirtualMethodInfo or GetVirtualInvokeData.
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    This does not look like a know bug. Is it possible for you to submit a project with a bug report to reproduce this? We would like to have a look to see if this is a case we have missed. Thanks.
     
  3. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    Shall I send the whole XCode project which is above 400MB? Or simply managed libraries?

    I must say I'm using Visual Basic for developing Unity games (which is rare I believe) but I managed to make my game run on my iOS Device (using mono backend ;)), and I cannot see if there are actual difference between VB&C# generated IL codes. If needed I may have a try.
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    @John Chen

    If you can send the Unity project, that would be best, actually. If it is too large to upload with the bug, you can submit the bug without the project, then mention that you would like to send the project via some other method. We can work out how to get the large project independently then.

    The fact that you are using VB here might be the issue, as IL2CPP is likely encountering some unexpected IL code. Still, we can investigate it.
     
  5. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    It seems that I shall try to reproduce the bug in a limited way to eliminate the needs for sending the whole project. I'm in China and have no proper way to share so large a file with you (look, many hours for uploading?)

    Meanwhile I shall post the IL code here.
    Code (CSharp):
    1. .method public
    2.     instance void PhaseIncrement (
    3.         int32 Phase
    4.     ) cil managed
    5. {
    6.     // Method begins at RVA 0x22c8
    7.     // Code size 95 (0x5f)
    8.     .maxstack 4
    9.     .locals init (
    10.         [0] bool VB$CG$t_bool$S0
    11.     )
    12.  
    13.     IL_0000: nop
    14.     IL_0001: ldarg.1
    15.     IL_0002: ldc.i4.0
    16.     IL_0003: beq.s IL_0011
    17.  
    18.     IL_0005: ldarg.1
    19.     IL_0006: ldarg.0
    20.     IL_0007: callvirt instance int32 Colosseum.Clients.SceneSplash::get_TotalPhases()
    21.     IL_000c: bge.s IL_0011
    22.  
    23.     IL_000e: ldc.i4.0
    24.     IL_000f: br.s IL_0012
    25.  
    26.     IL_0011: ldc.i4.1
    27.  
    28.     IL_0012: nop
    29.     IL_0013: stloc.0
    30.     IL_0014: ldloc.0
    31.     IL_0015: brfalse.s IL_0024
    32.  
    33.     IL_0017: ldarg.0
    34.     IL_0018: callvirt instance class Colosseum.Clients.Environment Colosseum.Clients.ColosseumBehaviour::get_Environment()
    35.     IL_001d: ldnull
    36.     IL_001e: callvirt instance void Colosseum.Clients.Environment::set_PhaseIncrement(class [mscorlib]System.Action`1<int32>)
    37.     IL_0023: nop
    38.  
    39.     IL_0024: ldarg.1
    40.     IL_0025: ldc.i4.0
    41.     IL_0026: beq.s IL_002b
    42.  
    43.     IL_0028: ldarg.1
    44.     IL_0029: br.s IL_0031
    45.  
    46.     IL_002b: ldarg.0
    47.     IL_002c: callvirt instance int32 Colosseum.Clients.SceneSplash::get_TotalPhases()
    48.  
    49.     IL_0031: starg.s Phase
    50.     IL_0033: ldarg.0
    51.     IL_0034: callvirt instance class Colosseum.Clients.Environment Colosseum.Clients.ColosseumBehaviour::get_Environment()
    52.     IL_0039: callvirt instance class ['Colosseum Shared Library']Colosseum.Clients.CommandQueue`1<class [UnityEngine]UnityEngine.GameObject> Colosseum.Clients.Environment::get_CommandQueue()
    53.     IL_003e: ldarg.0
    54.     IL_003f: dup
    55.     IL_0040: ldvirtftn instance void Colosseum.Clients.SceneSplash::PhaseIncrementInternal(class [UnityEngine]UnityEngine.GameObject, string)
    56.     IL_0046: newobj instance void class [System.Core]System.Action`2<class [UnityEngine]UnityEngine.GameObject, string>::.ctor(object, native int)
    57.     IL_004b: ldarg.0
    58.     IL_004c: callvirt instance class [UnityEngine]UnityEngine.GameObject [UnityEngine]UnityEngine.Component::get_gameObject()
    59.     IL_0051: ldarg.1
    60.     IL_0052: call string [Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.Conversions::ToString(int32)
    61.     IL_0057: callvirt instance void class ['Colosseum Shared Library']Colosseum.Clients.CommandQueue`1<class [UnityEngine]UnityEngine.GameObject>::ExecuteAction(class [System.Core]System.Action`2<!0, string>, !0, string)
    62.     IL_005c: nop
    63.     IL_005d: nop
    64.     IL_005e: ret
    65. } // end of method SceneSplash::PhaseIncrement
    Code (CSharp):
    1. .method public
    2.     instance void PhaseIncrementInternal (
    3.         class [UnityEngine]UnityEngine.GameObject Source,
    4.         string Data
    5.     ) cil managed
    6. {
    7.     // Method begins at RVA 0x2334
    8.     // Code size 168 (0xa8)
    9.     .maxstack 5
    10.     .locals init (
    11.         [0] int32 Phase,
    12.         [1] bool VB$CG$t_bool$S0
    13.     )
    14.  
    15.     IL_0000: nop
    16.     IL_0001: ldarg.2
    17.     IL_0002: call int32 [mscorlib]System.Int32::Parse(string)
    18.     IL_0007: stloc.0
    19.     IL_0008: ldarg.0
    20.     IL_0009: ldfld class Colosseum.Clients.ProgressTweener Colosseum.Clients.SceneSplash::Slider
    21.     IL_000e: ldloc.0
    22.     IL_000f: conv.r8
    23.     IL_0010: ldarg.0
    24.     IL_0011: callvirt instance int32 Colosseum.Clients.SceneSplash::get_TotalPhases()
    25.     IL_0016: conv.r8
    26.     IL_0017: div
    27.     IL_0018: conv.r4
    28.     IL_0019: callvirt instance void Colosseum.Clients.ProgressTweener::SetTarget(float32)
    29.     IL_001e: nop
    30.     IL_001f: ldloc.0
    31.     IL_0020: ldarg.0
    32.     IL_0021: callvirt instance int32 Colosseum.Clients.SceneSplash::get_TotalPhases()
    33.     IL_0026: ceq
    34.     IL_0028: stloc.1
    35.     IL_0029: ldloc.1
    36.     IL_002a: brfalse.s IL_003d
    37.  
    38.     IL_002c: ldarg.0
    39.     IL_002d: ldfld class Colosseum.Clients.SplashTexts Colosseum.Clients.SceneSplash::SplashTexts
    40.     IL_0032: callvirt instance class [System]System.Collections.Generic.Queue`1<string> Colosseum.Clients.SplashTexts::get_Texts()
    41.     IL_0037: callvirt instance void class [System]System.Collections.Generic.Queue`1<string>::Clear()
    42.     IL_003c: nop
    43.  
    44.     IL_003d: ldarg.0
    45.     IL_003e: ldfld class Colosseum.Clients.SplashTexts Colosseum.Clients.SceneSplash::SplashTexts
    46.     IL_0043: callvirt instance class [System]System.Collections.Generic.Queue`1<string> Colosseum.Clients.SplashTexts::get_Texts()
    47.     IL_0048: ldarg.0
    48.     IL_0049: callvirt instance class Colosseum.Clients.Localization Colosseum.Clients.ColosseumBehaviour::get_Localization()
    49.     IL_004e: ldstr "Splashes"
    50.     IL_0053: ldstr "Initializing "
    51.     IL_0058: ldloc.0
    52.     IL_0059: call string [Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.Conversions::ToString(int32)
    53.     IL_005e: call string [mscorlib]System.String::Concat(string, string)
    54.     IL_0063: callvirt instance string Colosseum.Clients.Localization::get_Item(string, string)
    55.     IL_0068: callvirt instance void class [System]System.Collections.Generic.Queue`1<string>::Enqueue(!0)
    56.     IL_006d: nop
    57.     IL_006e: ldarg.0
    58.     IL_006f: callvirt instance class Colosseum.Clients.Environment Colosseum.Clients.ColosseumBehaviour::get_Environment()
    59.     IL_0074: ldstr "Loading Progress: "
    60.     IL_0079: ldarg.0
    61.     IL_007a: ldfld class Colosseum.Clients.ProgressTweener Colosseum.Clients.SceneSplash::Slider
    62.     IL_007f: ldfld float32 Colosseum.Clients.ProgressTweener::Target
    63.     IL_0084: ldc.r4 100
    64.     IL_0089: mul
    65.     IL_008a: conv.r8
    66.     IL_008b: call float64 [mscorlib]System.Math::Round(float64)
    67.     IL_0090: call string [Microsoft.VisualBasic]Microsoft.VisualBasic.CompilerServices.Conversions::ToString(float64)
    68.     IL_0095: ldstr "%"
    69.     IL_009a: call string [mscorlib]System.String::Concat(string, string, string)
    70.     IL_009f: ldc.i4.0
    71.     IL_00a0: callvirt instance void Colosseum.Clients.Environment::Log(string, bool)
    72.     IL_00a5: nop
    73.     IL_00a6: nop
    74.     IL_00a7: ret
    75. } // end of method SceneSplash::PhaseIncrementInternal
    76.  
    .
     
  6. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    @JoshPeterson
    I've reproduced the problem though not exactly the same one. I've noticed that VBC are using ldvirtftn when CSC only use ldftn which is the most intriguing part. I don't really know what's different between them but it really happens.

    I'll submit a bugreport with a small project package to reproduce that.

    What's more, your IL2CPP compiler failed in Windows due to Microsoft.VisualBasic.dll (which has been modified by myself so as to pass the mono AOT) while in OS X it is fine.
     
  7. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    Update: I've submited the bug though I don't know how to get my ticket number.
     
  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    Thanks for tracking this down. We will investigate the bug.
     
  9. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    Thank you and please keep update to me if possible - I mean if you cannot reproduce the bug I will do something else to help you.
     
  10. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    I'll do that, thanks. Do you have a bug number yet? If not, can you let me know the email address (via a different, private conversation if you would like) that you used to submit this bug? That way I should be able to find it. Thanks.
     
  11. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    I've found that. It's Case 695179. Thank you again.
     
  12. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    It looks like we can reproduce it, so we will investigate, thanks.
     
  13. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    @JoshPeterson Two weeks passed and I am wondering if I need to provide further information to you. Thank you again.
     
  14. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    I've noticed that in 5.0.2p2 there are a fix describes as "Correct the implementation of the ldvirtftn opcode for types using a constrained generic generic parameter." Yet the issue number doesn't match mine, so I'm curious about what's happening and whether I shall try to download that.
     
  15. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    @John Chen

    No, you should not need to provide any further information about this bug. Our QA team has been able to reproduce it. You should have received confirmation from them about that, but I don't see a record of that communication in this bug. I apologize for the lack of communication.

    I doubt the correction in 5.0.2p2 will correct your issue, as that fix was specific to a case with generic types. I can't say for sure, so it might be worth trying 5.0.2p2, but they seem like two different issues.

    We will try to have a look at correcting the bug you submitted soon. Thanks.
     
  16. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    Many thanks to you. To introduce VB language to Unity crossing platforms is really a challenging thing, especially Microsoft.VisualBasic.dll lol
     
  17. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    Any news? I didn't receive any further instruction as well as message from bug reporting system. It is still 'open' there.
     
  18. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    Yes, actually. It looks like the bug was corrected just a few days ago. Our QA team will confirm the fix, and then should respond to you about the bug report. The fix is scheduled to make it into 5.0.3p2, which should be out this week.
     
  19. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    I shall try it then and report to you. Thank you very much! If there are any further problems I am glad to report it again.
     
  20. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    I cannot even get through the xcode compilation now. Although the 5.0.3p2 emerges several new problems that block IL2CPP to work, I may change my code to avoid that (all concerning generic parameters in delegates); yet when there are semantic errors in IL2CPP, I have no way to solve nor research into it.

    Generally speaking, all compilation errors are like "Use of undeclared label IL_00xx". There are usually blocks with such label BELOW, which makes compiler unavailable to recognize. Shall I upload the generated cpp to you? Or class libraries as well?
     
  21. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    It seems that it is Visual Basic's USING block that cause this problem. It can be reproduced easily in your side. I am now trying to destruct every USING block and see if it works.
     
  22. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    Also, I cannot return values in TRY or CATCH section. That shall cause the problem above as well.

    Still, using VB.
     
  23. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    My apologies, it sounds like something else in our dead branch analysis code is not correctly handling some IL that the VB compiler generates. The IL2CPP code is likely marking branches as dead when they really are not, and therefore skips some code generation.

    The best way to correct this is to report a bug via the editor and include a project that reproduces it. You can also send only the managed assemblies if you would like to. We will need at least them to reproduce the issue.
     
  24. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    Alright. May I send you one bug report with several problems at once?

    I also detected one problem which concerns the usage of closures within generic classes. IL2CPP refuses to compile.
     
  25. John-Chen350

    John-Chen350

    Joined:
    Jan 14, 2015
    Posts:
    53
    As for the closure problem, logs are just like "Unable to retrieve the runtime generic context ..."
     
  26. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    @John Chen

    yes, one bug report will be fine, thanks!
     
  27. akutruff

    akutruff

    Joined:
    Jul 24, 2009
    Posts:
    44
    We are getting "use of undeclared label" errors now for IL2CPP compiling to iOS with code written in C#. We are presently Unity 5.1.3, but we haven't tested IL2CPP.

    From looking at the cpp file, it appears to be as a result of us using a try finally block.
     
  28. akutruff

    akutruff

    Joined:
    Jul 24, 2009
    Posts:
    44
    Also, this is happening in a using block as well. Both the "try/finally" block and and the "using" are in iterator methods that use yield and have a return type of IEnumerator<object>

    Here is an example. NOTE: In case the while(true) is suspect concerning dead code detection... The iterator is evaluated outside this function, therefore the evaluating method on the Enumerator will be calling Dispose() on the Enumerator. Therefore, the finally block must execute, despite the infinite loop in the while true. In other words, the contents of the finally block are not dead code.


    Code (CSharp):
    1.     private IEnumerator<object> RunLoadedState(NexusCoroutine coroutine, CoroutineEventQueue queue, ShowMinionRequestedEventArgs args, AssetReference<GameObject> minionModelPrefabAsset)
    2.     {
    3.         try
    4.         {
    5.             CreateMinionModel(minionModelPrefabAsset.Asset, args.Locator, args.UseMirrored);
    6.  
    7.             var showMinionRequestedEvent = queue.Subscribe<ShowMinionRequestedEventArgs>(this);
    8.             var destroyMinionRequestedEvent = queue.Subscribe<DestroyMinionRequestedEventArgs>(this);
    9.             var anyEvent = coroutine.CreateWaitForAny(showMinionRequestedEvent, destroyMinionRequestedEvent);
    10.  
    11.             OnNext(this, new MinionShownEventArgs(_modelGameObject));
    12.  
    13.             while (true)
    14.             {
    15.                 yield return queue.Wait(anyEvent);
    16.  
    17.                 if (anyEvent.LastFired == showMinionRequestedEvent)
    18.                 {
    19.                     if (showMinionRequestedEvent.Args.Minion != args.Minion)
    20.                     {
    21.                         yield return coroutine.ReturnAndStartCoroutine(RunLoadingState(coroutine, queue, showMinionRequestedEvent.Args));
    22.                     }
    23.                     else
    24.                     {
    25.                         OnNext(this, new MinionShownEventArgs(_modelGameObject));
    26.                     }
    27.                 }
    28.                 else if (anyEvent.LastFired == destroyMinionRequestedEvent)
    29.                 {
    30.                     yield return coroutine.ReturnAndStartCoroutine(RunIdleState(coroutine, queue));
    31.                 }
    32.             }
    33.         }
    34.         finally
    35.         {
    36.             _modelGameObject.DestroyGameObjectIfNotNull();
    37.  
    38.             _characterPrefabTable.Release(minionModelPrefabAsset);
    39.         }
    40.     }

    GENERATED C++



    Code (CSharp):
    1. // System.Boolean UIMinionModelController/<RunLoadedState>c__IteratorDA::MoveNext()
    2.  
    3. extern TypeInfo* ObjectU5BU5D_t1063_il2cpp_TypeInfo_var;
    4.  
    5. extern TypeInfo* MinionShownEventArgs_t1866_il2cpp_TypeInfo_var;
    6.  
    7. extern const MethodInfo* AssetReference_1_get_Asset_m16147_MethodInfo_var;
    8.  
    9. extern const MethodInfo* CoroutineEventQueue_Subscribe_TisShowMinionRequestedEventArgs_t1864_m16128_MethodInfo_var;
    10.  
    11. extern const MethodInfo* CoroutineEventQueue_Subscribe_TisDestroyMinionRequestedEventArgs_t1865_m16129_MethodInfo_var;
    12.  
    13. extern const MethodInfo* InjectionBehaviour_OnNext_TisUIMinionModelController_t1712_TisMinionShownEventArgs_t1866_m16148_MethodInfo_var;
    14.  
    15. extern "C" bool U3CRunLoadedStateU3Ec__IteratorDA_MoveNext_m8634 (U3CRunLoadedStateU3Ec__IteratorDA_t1872 * __this, const MethodInfo* method)
    16.  
    17. {
    18.  
    19. static bool s_Il2CppMethodIntialized;
    20.  
    21. if (!s_Il2CppMethodIntialized)
    22.  
    23. {
    24.  
    25. ObjectU5BU5D_t1063_il2cpp_TypeInfo_var = il2cpp_codegen_type_info_from_index(69);
    26.  
    27. MinionShownEventArgs_t1866_il2cpp_TypeInfo_var = il2cpp_codegen_type_info_from_index(1639);
    28.  
    29. AssetReference_1_get_Asset_m16147_MethodInfo_var = il2cpp_codegen_method_info_from_index(2147486067);
    30.  
    31. CoroutineEventQueue_Subscribe_TisShowMinionRequestedEventArgs_t1864_m16128_MethodInfo_var = il2cpp_codegen_method_info_from_index(2147486061);
    32.  
    33. CoroutineEventQueue_Subscribe_TisDestroyMinionRequestedEventArgs_t1865_m16129_MethodInfo_var = il2cpp_codegen_method_info_from_index(2147486062);
    34.  
    35. InjectionBehaviour_OnNext_TisUIMinionModelController_t1712_TisMinionShownEventArgs_t1866_m16148_MethodInfo_var = il2cpp_codegen_method_info_from_index(2147486068);
    36.  
    37. s_Il2CppMethodIntialized = true;
    38.  
    39. }
    40.  
    41. uint32_t V_0 = 0;
    42.  
    43. bool V_1 = false;
    44.  
    45. Exception_t11 * __last_unhandled_exception = 0;
    46.  
    47. NO_UNUSED_WARNING (__last_unhandled_exception);
    48.  
    49. Exception_t11 * __exception_local = 0;
    50.  
    51. NO_UNUSED_WARNING (__exception_local);
    52.  
    53. int32_t __leave_target = 0;
    54.  
    55. NO_UNUSED_WARNING (__leave_target);
    56.  
    57. {
    58.  
    59. int32_t L_0 = (__this->___U24PC_7);
    60.  
    61. V_0 = L_0;
    62.  
    63. __this->___U24PC_7 = (-1);
    64.  
    65. V_1 = 0;
    66.  
    67. uint32_t L_1 = V_0;
    68.  
    69. if (L_1 == 0)
    70.  
    71. {
    72.  
    73. goto IL_002b;
    74.  
    75. }
    76.  
    77. if (L_1 == 1)
    78.  
    79. {
    80.  
    81. goto IL_002e;
    82.  
    83. }
    84.  
    85. if (L_1 == 2)
    86.  
    87. {
    88.  
    89. goto IL_002e;
    90.  
    91. }
    92.  
    93. if (L_1 == 3)
    94.  
    95. {
    96.  
    97. goto IL_002e;
    98.  
    99. }
    100.  
    101. }
    102.  
    103. {
    104.  
    105. goto IL_0216;
    106.  
    107. }
    108.  
    109.  
    110.  
    111. IL_002b:
    112.  
    113. {
    114.  
    115. V_0 = ((int32_t)-3);
    116.  
    117. }
    118.  
    119.  
    120.  
    121. IL_002e:
    122.  
    123. try
    124.  
    125. { // begin try (depth: 1)
    126.  
    127. {
    128.  
    129. uint32_t L_2 = V_0;
    130.  
    131. if (((int32_t)((int32_t)L_2-(int32_t)1)) == 0)
    132.  
    133. {
    134.  
    135. goto IL_010c;
    136.  
    137. }
    138.  
    139. if (((int32_t)((int32_t)L_2-(int32_t)1)) == 1)
    140.  
    141. {
    142.  
    143. goto IL_0183;
    144.  
    145. }
    146.  
    147. if (((int32_t)((int32_t)L_2-(int32_t)1)) == 2)
    148.  
    149. {
    150.  
    151. goto IL_01fa;
    152.  
    153. }
    154.  
    155. }
    156.  
    157.  
    158.  
    159. IL_0042:
    160.  
    161. {
    162.  
    163. UIMinionModelController_t1712 * L_3 = (__this->___U3CU3Ef__this_13);
    164.  
    165. AssetReference_1_t1863 * L_4 = (__this->___minionModelPrefabAsset_0);
    166.  
    167. NullCheck(L_4);
    168.  
    169. GameObject_t60 * L_5 = AssetReference_1_get_Asset_m16147(L_4, /*hidden argument*/AssetReference_1_get_Asset_m16147_MethodInfo_var);
    170.  
    171. ShowMinionRequestedEventArgs_t1864 * L_6 = (__this->___args_1);
    172.  
    173. NullCheck(L_6);
    174.  
    175. GameObject_t60 * L_7 = ShowMinionRequestedEventArgs_get_Locator_m8611(L_6, /*hidden argument*/NULL);
    176.  
    177. ShowMinionRequestedEventArgs_t1864 * L_8 = (__this->___args_1);
    178.  
    179. NullCheck(L_8);
    180.  
    181. bool L_9 = ShowMinionRequestedEventArgs_get_UseMirrored_m8613(L_8, /*hidden argument*/NULL);
    182.  
    183. NullCheck(L_3);
    184.  
    185. UIMinionModelController_CreateMinionModel_m8661(L_3, L_5, L_7, L_9, /*hidden argument*/NULL);
    186.  
    187. CoroutineEventQueue_t88 * L_10 = (__this->___queue_2);
    188.  
    189. UIMinionModelController_t1712 * L_11 = (__this->___U3CU3Ef__this_13);
    190.  
    191. NullCheck(L_10);
    192.  
    193. CoroutineEvent_2_t1868 * L_12 = CoroutineEventQueue_Subscribe_TisShowMinionRequestedEventArgs_t1864_m16128(L_10, L_11, /*hidden argument*/CoroutineEventQueue_Subscribe_TisShowMinionRequestedEventArgs_t1864_m16128_MethodInfo_var);
    194.  
    195. __this->___U3CshowMinionRequestedEventU3E__0_3 = L_12;
    196.  
    197. CoroutineEventQueue_t88 * L_13 = (__this->___queue_2);
    198.  
    199. UIMinionModelController_t1712 * L_14 = (__this->___U3CU3Ef__this_13);
    200.  
    201. NullCheck(L_13);
    202.  
    203. CoroutineEvent_2_t1870 * L_15 = CoroutineEventQueue_Subscribe_TisDestroyMinionRequestedEventArgs_t1865_m16129(L_13, L_14, /*hidden argument*/CoroutineEventQueue_Subscribe_TisDestroyMinionRequestedEventArgs_t1865_m16129_MethodInfo_var);
    204.  
    205. __this->___U3CdestroyMinionRequestedEventU3E__1_4 = L_15;
    206.  
    207. NexusCoroutine_t23 * L_16 = (__this->___coroutine_5);
    208.  
    209. ObjectU5BU5D_t1063* L_17 = ((ObjectU5BU5D_t1063*)SZArrayNew(ObjectU5BU5D_t1063_il2cpp_TypeInfo_var, 2));
    210.  
    211. CoroutineEvent_2_t1868 * L_18 = (__this->___U3CshowMinionRequestedEventU3E__0_3);
    212.  
    213. NullCheck(L_17);
    214.  
    215. IL2CPP_ARRAY_BOUNDS_CHECK(L_17, 0);
    216.  
    217. ArrayElementTypeCheck (L_17, L_18);
    218.  
    219. *((Object_t **)(Object_t **)SZArrayLdElema(L_17, 0, sizeof(Object_t *))) = (Object_t *)L_18;
    220.  
    221. ObjectU5BU5D_t1063* L_19 = L_17;
    222.  
    223. CoroutineEvent_2_t1870 * L_20 = (__this->___U3CdestroyMinionRequestedEventU3E__1_4);
    224.  
    225. NullCheck(L_19);
    226.  
    227. IL2CPP_ARRAY_BOUNDS_CHECK(L_19, 1);
    228.  
    229. ArrayElementTypeCheck (L_19, L_20);
    230.  
    231. *((Object_t **)(Object_t **)SZArrayLdElema(L_19, 1, sizeof(Object_t *))) = (Object_t *)L_20;
    232.  
    233. NullCheck(L_16);
    234.  
    235. WaitForAnyCoroutineEvent_t103 * L_21 = NexusCoroutine_CreateWaitForAny_m13505(L_16, L_19, /*hidden argument*/NULL);
    236.  
    237. __this->___U3CanyEventU3E__2_6 = L_21;
    238.  
    239. UIMinionModelController_t1712 * L_22 = (__this->___U3CU3Ef__this_13);
    240.  
    241. UIMinionModelController_t1712 * L_23 = (__this->___U3CU3Ef__this_13);
    242.  
    243. UIMinionModelController_t1712 * L_24 = (__this->___U3CU3Ef__this_13);
    244.  
    245. NullCheck(L_24);
    246.  
    247. GameObject_t60 * L_25 = (L_24->____modelGameObject_8);
    248.  
    249. MinionShownEventArgs_t1866 * L_26 = (MinionShownEventArgs_t1866 *)il2cpp_codegen_object_new (MinionShownEventArgs_t1866_il2cpp_TypeInfo_var);
    250.  
    251. MinionShownEventArgs__ctor_m8616(L_26, L_25, /*hidden argument*/NULL);
    252.  
    253. NullCheck(L_22);
    254.  
    255. InjectionBehaviour_OnNext_TisUIMinionModelController_t1712_TisMinionShownEventArgs_t1866_m16148(L_22, L_23, L_26, /*hidden argument*/InjectionBehaviour_OnNext_TisUIMinionModelController_t1712_TisMinionShownEventArgs_t1866_m16148_MethodInfo_var);
    256.  
    257. }
    258.  
    259.  
    260.  
    261. IL_00e7:
    262.  
    263. {
    264.  
    265. CoroutineEventQueue_t88 * L_27 = (__this->___queue_2);
    266.  
    267. WaitForAnyCoroutineEvent_t103 * L_28 = (__this->___U3CanyEventU3E__2_6);
    268.  
    269. NullCheck(L_27);
    270.  
    271. Object_t * L_29 = CoroutineEventQueue_Wait_m13477(L_27, L_28, /*hidden argument*/NULL);
    272.  
    273. __this->___U24current_8 = L_29;
    274.  
    275. __this->___U24PC_7 = 1;
    276.  
    277. V_1 = 1;
    278.  
    279. IL2CPP_LEAVE(0x218, FINALLY_0204);
    280.  
    281. }
    282.  
    283.  
    284.  
    285. IL_010c:
    286.  
    287. {
    288.  
    289. WaitForAnyCoroutineEvent_t103 * L_30 = (__this->___U3CanyEventU3E__2_6);
    290.  
    291. NullCheck(L_30);
    292.  
    293. Object_t * L_31 = WaitForAnyCoroutineEvent_get_LastFired_m13506(L_30, /*hidden argument*/NULL);
    294.  
    295. CoroutineEvent_2_t1868 * L_32 = (__this->___U3CshowMinionRequestedEventU3E__0_3);
    296.  
    297. if ((!(((Object_t*)(Object_t *)L_31) == ((Object_t*)(CoroutineEvent_2_t1868 *)L_32))))
    298.  
    299. {
    300.  
    301. goto IL_01ae;
    302.  
    303. }
    304.  
    305. }
    306.  
    307.  
    308.  
    309. IL_0122:
    310.  
    311. {
    312.  
    313. CoroutineEvent_2_t1868 * L_33 = (__this->___U3CshowMinionRequestedEventU3E__0_3);
    314.  
    315. NullCheck(L_33);
    316.  
    317. ShowMinionRequestedEventArgs_t1864 * L_34 = (L_33->___Args_2);
    318.  
    319. NullCheck(L_34);
    320.  
    321. MinionComponent_t1680 * L_35 = ShowMinionRequestedEventArgs_get_Minion_m8609(L_34, /*hidden argument*/NULL);
    322.  
    323. ShowMinionRequestedEventArgs_t1864 * L_36 = (__this->___args_1);
    324.  
    325. NullCheck(L_36);
    326.  
    327. MinionComponent_t1680 * L_37 = ShowMinionRequestedEventArgs_get_Minion_m8609(L_36, /*hidden argument*/NULL);
    328.  
    329. if ((((Object_t*)(MinionComponent_t1680 *)L_35) == ((Object_t*)(MinionComponent_t1680 *)L_37)))
    330.  
    331. {
    332.  
    333. goto IL_0188;
    334.  
    335. }
    336.  
    337. }
    338.  
    339.  
    340.  
    341. IL_0142:
    342.  
    343. {
    344.  
    345. NexusCoroutine_t23 * L_38 = (__this->___coroutine_5);
    346.  
    347. UIMinionModelController_t1712 * L_39 = (__this->___U3CU3Ef__this_13);
    348.  
    349. NexusCoroutine_t23 * L_40 = (__this->___coroutine_5);
    350.  
    351. CoroutineEventQueue_t88 * L_41 = (__this->___queue_2);
    352.  
    353. CoroutineEvent_2_t1868 * L_42 = (__this->___U3CshowMinionRequestedEventU3E__0_3);
    354.  
    355. NullCheck(L_42);
    356.  
    357. ShowMinionRequestedEventArgs_t1864 * L_43 = (L_42->___Args_2);
    358.  
    359. NullCheck(L_39);
    360.  
    361. Object_t* L_44 = UIMinionModelController_RunLoadingState_m8656(L_39, L_40, L_41, L_43, /*hidden argument*/NULL);
    362.  
    363. NullCheck(L_38);
    364.  
    365. Object_t * L_45 = NexusCoroutine_ReturnAndStartCoroutine_m13478(L_38, L_44, /*hidden argument*/NULL);
    366.  
    367. __this->___U24current_8 = L_45;
    368.  
    369. __this->___U24PC_7 = 2;
    370.  
    371. V_1 = 1;
    372.  
    373. IL2CPP_LEAVE(0x218, FINALLY_0204);
    374.  
    375. }
    376.  
    377.  
    378.  
    379. IL_0183:
    380.  
    381. {
    382.  
    383. goto IL_01a9;
    384.  
    385. }
    386.  
    387.  
    388.  
    389. IL_0188:
    390.  
    391. {
    392.  
    393. UIMinionModelController_t1712 * L_46 = (__this->___U3CU3Ef__this_13);
    394.  
    395. UIMinionModelController_t1712 * L_47 = (__this->___U3CU3Ef__this_13);
    396.  
    397. UIMinionModelController_t1712 * L_48 = (__this->___U3CU3Ef__this_13);
    398.  
    399. NullCheck(L_48);
    400.  
    401. GameObject_t60 * L_49 = (L_48->____modelGameObject_8);
    402.  
    403. MinionShownEventArgs_t1866 * L_50 = (MinionShownEventArgs_t1866 *)il2cpp_codegen_object_new (MinionShownEventArgs_t1866_il2cpp_TypeInfo_var);
    404.  
    405. MinionShownEventArgs__ctor_m8616(L_50, L_49, /*hidden argument*/NULL);
    406.  
    407. NullCheck(L_46);
    408.  
    409. InjectionBehaviour_OnNext_TisUIMinionModelController_t1712_TisMinionShownEventArgs_t1866_m16148(L_46, L_47, L_50, /*hidden argument*/InjectionBehaviour_OnNext_TisUIMinionModelController_t1712_TisMinionShownEventArgs_t1866_m16148_MethodInfo_var);
    410.  
    411. }
    412.  
    413.  
    414.  
    415. IL_01a9:
    416.  
    417. {
    418.  
    419. goto IL_01fa;
    420.  
    421. }
    422.  
    423.  
    424.  
    425. IL_01ae:
    426.  
    427. {
    428.  
    429. WaitForAnyCoroutineEvent_t103 * L_51 = (__this->___U3CanyEventU3E__2_6);
    430.  
    431. NullCheck(L_51);
    432.  
    433. Object_t * L_52 = WaitForAnyCoroutineEvent_get_LastFired_m13506(L_51, /*hidden argument*/NULL);
    434.  
    435. CoroutineEvent_2_t1870 * L_53 = (__this->___U3CdestroyMinionRequestedEventU3E__1_4);
    436.  
    437. if ((!(((Object_t*)(Object_t *)L_52) == ((Object_t*)(CoroutineEvent_2_t1870 *)L_53))))
    438.  
    439. {
    440.  
    441. goto IL_01fa;
    442.  
    443. }
    444.  
    445. }
    446.  
    447.  
    448.  
    449. IL_01c4:
    450.  
    451. {
    452.  
    453. NexusCoroutine_t23 * L_54 = (__this->___coroutine_5);
    454.  
    455. UIMinionModelController_t1712 * L_55 = (__this->___U3CU3Ef__this_13);
    456.  
    457. NexusCoroutine_t23 * L_56 = (__this->___coroutine_5);
    458.  
    459. CoroutineEventQueue_t88 * L_57 = (__this->___queue_2);
    460.  
    461. NullCheck(L_55);
    462.  
    463. Object_t* L_58 = UIMinionModelController_RunIdleState_m8655(L_55, L_56, L_57, /*hidden argument*/NULL);
    464.  
    465. NullCheck(L_54);
    466.  
    467. Object_t * L_59 = NexusCoroutine_ReturnAndStartCoroutine_m13478(L_54, L_58, /*hidden argument*/NULL);
    468.  
    469. __this->___U24current_8 = L_59;
    470.  
    471. __this->___U24PC_7 = 3;
    472.  
    473. V_1 = 1;
    474.  
    475. IL2CPP_LEAVE(0x218, FINALLY_0204);
    476.  
    477. }
    478.  
    479.  
    480.  
    481. IL_01fa:
    482.  
    483. {
    484.  
    485. goto IL_00e7;
    486.  
    487. }
    488.  
    489.  
    490.  
    491. IL_01ff:
    492.  
    493. {
    494.  
    495. IL2CPP_LEAVE(0x20F, FINALLY_0204);
    496.  
    497. }
    498.  
    499. } // end try (depth: 1)
    500.  
    501. catch(Il2CppExceptionWrapper& e)
    502.  
    503. {
    504.  
    505. __last_unhandled_exception = (Exception_t11 *)e.ex;
    506.  
    507. goto FINALLY_0204;
    508.  
    509. }
    510.  
    511.  
    512.  
    513. FINALLY_0204:
    514.  
    515. { // begin finally (depth: 1)
    516.  
    517. {
    518.  
    519. bool L_60 = V_1;
    520.  
    521. if (!L_60)
    522.  
    523. {
    524.  
    525. goto IL_0208;
    526.  
    527. }
    528.  
    529. }
    530.  
    531.  
    532.  
    533. IL_0207:
    534.  
    535. {
    536.  
    537. IL2CPP_END_FINALLY(516)
    538.  
    539. }
    540.  
    541.  
    542.  
    543. IL_0208:
    544.  
    545. {
    546.  
    547. U3CRunLoadedStateU3Ec__IteratorDA_U3CU3E__Finally0_m8637(__this, /*hidden argument*/NULL);
    548.  
    549. IL2CPP_END_FINALLY(516)
    550.  
    551. }
    552.  
    553. } // end finally (depth: 1)
    554.  
    555. IL2CPP_CLEANUP(516)
    556.  
    557. {
    558.  
    559. IL2CPP_JUMP_TBL(0x218, IL_0218)
    560.  
    561. IL2CPP_JUMP_TBL(0x20F, IL_020f)
    562.  
    563. IL2CPP_RETHROW_IF_UNHANDLED(Exception_t11 *)
    564.  
    565. }
    566.  
    567. // Dead block : IL_020f: ldarg.0
    568.  
    569.  
    570.  
    571. IL_0216:
    572.  
    573. {
    574.  
    575. return 0;
    576.  
    577. }
    578.  
    579.  
    580.  
    581. IL_0218:
    582.  
    583. {
    584.  
    585. return 1;
    586.  
    587. }
    588.  
    589. }
     
    Last edited: Aug 25, 2015
  29. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    @akutruff

    It is difficult to determine the cause of this issue from this C# code alone, as we will likely need to see the IL code to determine why IL2CPP is doing the wrong thing during its dead code analysis. Can you submit a bug report with this project or with a smaller project which reproduces this issue?

    Also, is this a regression from previous versions where this worked with IL2CPP? We fixed some dead code analysis bugs a few months ago, but I don't recall any recent changes to this area.
     
  30. akutruff

    akutruff

    Joined:
    Jul 24, 2009
    Posts:
    44
    This may be a regression but the last version we tested this on was a few versions ago.

    The problem we continually run into with Unity bugs concerting your request to submit a small project that reproduces the issue. I have no problem doing that if it's something that is easy to do. However, I've had limited success rate in doing so. For example, I spent two days last week trying to create a project for another bug and I was never able to reproduce it. I ended up having to upload the 10GB anyway and walk a kind developer through the setup steps. Also, if I try to create one, the iteration time for IL2CPP is 5 minutes at a time. Our project has spanned years and is huge. Is it possible to just submit the IL and the CPP contents? I just want to make sure that you're aware that by trying to make a "simple" project for you, it may be significant work on our end.
     
  31. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    @akutruff

    Yes, we can probably sort this issue out with the original IL assemblies and the C++ code. If you can submit that, it will at least get us started. Thanks.
     
  32. akutruff

    akutruff

    Joined:
    Jul 24, 2009
    Posts:
    44
    Sweet! Where is the intermediate IL spit out when building on OSX for iOS?
     
  33. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,775
    @akutruff

    It could be in a slightly different place, depending on the version of Unity. I'm not entirely sure about where 5.1.3 puts it off the top of my head. Try building a development player, and look in the Data/Managed folder in the output directory. I *think* it goes there, although it might get deleted near the end of the build process, I don't recall.

    The best way to be sure is to look at the command line arguments passed to il2cpp.exe during the build process. The managed assemblies should be passed on the command line.
     
  34. akutruff

    akutruff

    Joined:
    Jul 24, 2009
    Posts:
    44