Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Unity.CollabProxy.Editor causing ReflectionTypeLoadException

Discussion in '2020.1 Beta' started by KingKRoecks, Apr 23, 2021.

  1. KingKRoecks

    KingKRoecks

    Joined:
    Jul 28, 2013
    Posts:
    155
    Hey all, Unity Collaborate appears to be causing issues with assembly parsing.

    Since upgrading to 2021.1.4f1 (upgraded from 2020), I've been getting this error log when I enter play-mode:

    Code (CSharp):
    1. ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
    2. System.Reflection.Assembly.GetTypes () (at <695d1cc93cca45069c528c15c9fdd749>:0)
    3. Unity.XR.OpenVR.OpenVRHelpers+<>c.<GetType>b__2_4 (System.Reflection.Assembly assembly) (at Library/PackageCache/com.valvesoftware.unity.openvr@01128f4e36ed-1614121125000/Runtime/OpenVRHelpers.cs:35)
    4. System.Linq.Enumerable+<SelectManyIterator>d__167`3[TSource,TCollection,TResult].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    5. System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    6. System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Boolean& found) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    7. System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
    8. Unity.XR.OpenVR.OpenVRHelpers.GetType (System.String className, System.Boolean fullname) (at Library/PackageCache/com.valvesoftware.unity.openvr@01128f4e36ed-1614121125000/Runtime/OpenVRHelpers.cs:34)
    9. Unity.XR.OpenVR.OpenVRHelpers.DoesTypeExist (System.String className, System.Boolean fullname) (at Library/PackageCache/com.valvesoftware.unity.openvr@01128f4e36ed-1614121125000/Runtime/OpenVRHelpers.cs:19)
    10. Unity.XR.OpenVR.OpenVRHelpers.IsUsingSteamVRInput () (at Library/PackageCache/com.valvesoftware.unity.openvr@01128f4e36ed-1614121125000/Runtime/OpenVRHelpers.cs:14)
    11. Unity.XR.OpenVR.OpenVRLoader.Initialize () (at Library/PackageCache/com.valvesoftware.unity.openvr@01128f4e36ed-1614121125000/Runtime/OpenVRLoader.cs:175)
    12. UnityEngine.XR.Management.XRManagerSettings.InitializeLoaderSync () (at Library/PackageCache/com.unity.xr.management@4.0.1/Runtime/XRManagerSettings.cs:187)
    13. UnityEngine.XR.Management.XRGeneralSettings.InitXRSDK () (at Library/PackageCache/com.unity.xr.management@4.0.1/Runtime/XRGeneralSettings.cs:175)
    14. UnityEngine.XR.Management.XRGeneralSettings.AttemptInitializeXRSDKOnLoad () (at Library/PackageCache/com.unity.xr.management@4.0.1/Runtime/XRGeneralSettings.cs:148)
    I created a quick class to debug this:

    Code (CSharp):
    1. using System;
    2. using UnityEditor;
    3. using UnityEngine;
    4.  
    5. namespace TrollKing.Windows
    6. {
    7.     public static class TestClassFailure
    8.     {
    9.         [MenuItem("TrollKing/Debug fail")]
    10.         public static void VerifyAssemblyTypes()
    11.         {
    12.             try
    13.             {
    14.                 bool success = GetTypeCheck("SteamVR_Input") != null;
    15.             }
    16.             catch (Exception e)
    17.             {
    18.                 Debug.LogError(e);
    19.             }
    20.         }
    21.  
    22.         public static Type GetTypeCheck(string className)
    23.         {
    24.             var assPile = AppDomain.CurrentDomain.GetAssemblies();
    25.             foreach (var ass in assPile)
    26.             {
    27.                 try
    28.                 {
    29.                     var assTypes = ass.GetTypes();
    30.                     foreach (var assT in assTypes)
    31.                     {
    32.                         if (assT.Name == className)
    33.                         {
    34.                             return assT;
    35.                         }
    36.                     }
    37.                 }
    38.                 catch (Exception e)
    39.                 {
    40.                     Debug.LogError($"Failed to get assembly types for {ass} " + e);
    41.                 }
    42.             }
    43.  
    44.             return null;
    45.         }
    46.     }
    47. }
    With that, I was able to verify that the issue lies in this "Unity.CollabProxy.Editor" assembly.

    Code (csharp):
    1.  
    2.  
    3. Failed to get assembly types for Unity.CollabProxy.Editor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
    4.   at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
    5.   at System.Reflection.Assembly.GetTypes () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
    6.   at TrollKing.Windows.TestClassFailure.GetTypeCheck (System.String className) [0x00019] in C:\game_projects\VoxelMage\Assets\Editor\Windows\TestClassFailure.cs:29
    7. UnityEngine.Debug:LogError (object)
    8. TrollKing.Windows.TestClassFailure:GetTypeCheck (string) (at Assets/Editor/Windows/TestClassFailure.cs:40)
    9. TrollKing.Windows.TestClassFailure:VerifyAssemblyTypes () (at Assets/Editor/Windows/TestClassFailure.cs:14)
    10.  
    Removing the "Unity Collaborate" package from Package Manager appears to remove the errors.