Performance Testing Extension for Unity Test Runner and IL2CPP

Hi,

I use successfully the API using tests that run with the Standalone Windows 64bit player, but this only if I run them with mono. if I run them with IL2CPP, I get this crash:

UnloadTime: 0.284600 ms
ArgumentException: Type provided to TestRunCallbackAttribute does not implement ITestRunCallback
  at UnityEngine.TestRunner.TestRunCallbackAttribute..ctor (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
  at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00000] in <00000000000000000000000000000000>:0
  at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.TestRunner.Utils.TestRunCallbackListener+<>c.<GetAllCallbacks>b__2_1 (System.Reflection.Assembly assembly) [0x00000] in <00000000000000000000000000000000>:0
  at System.Runtime.CompilerServices.ConditionalWeakTable`2+CreateValueCallback[TKey,TValue].Invoke (TKey key) [0x00000] in <00000000000000000000000000000000>:0
  at System.Linq.Enumerable+<SelectManyIterator>d__17`2[TSource,TResult].MoveNext () [0x00000] in <00000000000000000000000000000000>:0
  at Newtonsoft.Json.Utilities.BidirectionalDictionary`2[TFirst,TSecond]..ctor (System.Collections.Generic.IEqualityComparer`1[T] firstEqualityComparer, System.Collections.Generic.IEqualityComparer`1[T] secondEqualityComparer, System.String duplicateFirstErrorMessage, System.String duplicateSecondErrorMessage) [0x00000] in <00000000000000000000000000000000>:0
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.TestRunner.Utils.TestRunCallbackListener.GetAllCallbacks () [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.TestRunner.Utils.TestRunCallbackListener.InvokeAllCallbacks (System.Action`1[T] invoker) [0x00000] in <00000000000000000000000000000000>:0
  at System.Action`1[T].Invoke (T obj) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.Events.InvokableCall`1[T1].Invoke (T1 args0) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.Events.UnityEvent`1[T0].Invoke (T0 arg0) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.TestTools.TestRunner.PlaymodeTestsController+<Run>d__16.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.TestTools.TestRunner.PlaymodeTestsController+<Start>d__12.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.TestTools.TestRunner.<Start>d__12:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

My code looks like:

[Test, Performance]
        public void TestStandardRandomInsert()
        {
            Measure.Method(() =>
                    {
                        for (int index = 0; index < dictionarySize; index++)
                            standardDictionary[randomIndices[index]] = new Test(index);
                    })
                   .WarmupCount(3)
                   .MeasurementCount(10)
                   .IterationsPerMeasurement(10)
                   .Run();
        }

if it’s not my fault, can someone look at it? I really need to run those profilings with IL2CPP as well. Otherwise please let me know what I am doing wrong.

It is likely the same issue as in ArgumentException: Type provided to TestRunCallbackAttribute does not implement ITestRunCallback

1 Like

thank you! I scanned and googled but didn’t notice that thread. IT’s surely the same thing