Search Unity

Bug ArgumentOutOfRangeException Introduced in 1.4.0-preview.1

Discussion in 'Burst' started by kadd11, Mar 8, 2021.

  1. kadd11

    kadd11

    Joined:
    Mar 11, 2018
    Posts:
    33
    Hi, I just upgraded from what I realized was an older version of burst (1.3.0-preview.12) and found exceptions being thrown in BurstReflection.cs whenever a domain reload happens. For example, in CollectGenericTypeInstances, when it calls ResolveType and ResolveField. The exception is handled, but it makes debugging very annoying as you have to selectively ignore these exceptions everytime you've changed your exception settings.

    I wonder if it's related to the changelog for 1.4.0-preview.1: "Job Entry point symbols should now reflect the job name and type rather than a hash in callstacks/native profilers."?

    I have verified that the first version where this issue occurs is in 1.4.0-preview.1, and it still occurs in the latest version (currently 1.5.0-pre.5). Here is an example exception:


    Code (CSharp):
    1. System.ArgumentOutOfRangeException: Token 0x1b0001da is not valid in the scope of module Unity.Timeline.Editor.dll Parameter name: metadataToken
    2.   at System.Reflection.MonoModule.ResolveType (System.Int32 metadataToken, System.Type[] genericTypeArguments, System.Type[] genericMethodArguments) [0x00037] in <9577ac7a62ef43179789031239ba8798>:0
    3.   at System.Reflection.Module.ResolveType (System.Int32 metadataToken) [0x00000] in <9577ac7a62ef43179789031239ba8798>:0
    4.   at Unity.Burst.Editor.BurstReflection.CollectGenericTypeInstances (System.Reflection.Assembly assembly, System.Func`2[T,TResult] typeFilter, System.Collections.Generic.List`1[T] types, System.Collections.Generic.HashSet`1[T] visited) [0x00037] in com.unity.burst@1.4.0-pre.1\Editor\BurstReflection.cs:757
     
  2. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    Could you submit a repro for us for this? We'll try and get it fixed!
     
  3. kadd11

    kadd11

    Joined:
    Mar 11, 2018
    Posts:
    33
    Hi, I attached a project that repros it. It's very simple, I made a new project, and added the following script:


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using Unity.Burst;
    4. using Unity.Collections;
    5. using Unity.Jobs;
    6. using UnityEngine;
    7.  
    8. [BurstCompile]
    9. internal struct RenderOrderAndFilterJob : IJob
    10. {
    11.     public NativeArray<int> Foo;
    12.     public void Execute()
    13.     {
    14.         throw new System.NotImplementedException();
    15.     }
    16. }
    17.  
    18. public class TestJob : MonoBehaviour
    19. {
    20.  
    21. }
    If you then attach visual studio (make sure to check all Command Language Runtime Exceptions) in the exception window, and then do a domain reload, it should hit the exception I'm talking about.
     

    Attached Files: