hybrid-packages icon indicating copy to clipboard operation
hybrid-packages copied to clipboard

TargetInvocationException on MacOS in Unity 2022.2.5

Open cecarlsen opened this issue 2 years ago • 2 comments

Importing the Hybrid Packages package results in this error:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ComponentModel.Win32Exception: Invalid data
  at MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform.SetMemPerms (System.IntPtr start, System.UInt64 len, MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform+MmapProts prot) [0x00043] in <88b084d277f344aa9c2904c640976875>:0 
  at MonoMod.RuntimeDetour.Platforms.DetourNativeLibcPlatform.MakeWritable (System.IntPtr src, System.UInt32 size) [0x00000] in <88b084d277f344aa9c2904c640976875>:0 
  at MonoMod.RuntimeDetour.DetourHelper.MakeWritable (MonoMod.RuntimeDetour.IDetourNativePlatform plat, MonoMod.RuntimeDetour.NativeDetourData detour) [0x00000] in <88b084d277f344aa9c2904c640976875>:0 
  at MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform._HookSelftest (System.Reflection.MethodInfo from, System.Reflection.MethodInfo to) [0x00035] in <88b084d277f344aa9c2904c640976875>:0 
  at MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform..ctor () [0x0003f] in <88b084d277f344aa9c2904c640976875>:0 
  at MonoMod.RuntimeDetour.Platforms.DetourRuntimeMonoPlatform..ctor () [0x00000] in <88b084d277f344aa9c2904c640976875>:0 
  at MonoMod.RuntimeDetour.DetourHelper.get_Runtime () [0x0003e] in <88b084d277f344aa9c2904c640976875>:0 
  at MonoMod.RuntimeDetour.DetourHelper.Pin[T] (T method) [0x00000] in <88b084d277f344aa9c2904c640976875>:0 
  at HarmonyLib.MethodPatcher.CreateReplacement (System.Collections.Generic.Dictionary`2[System.Int32,HarmonyLib.CodeInstruction]& finalInstructions) [0x005a6] in <88b084d277f344aa9c2904c640976875>:0 
  at HarmonyLib.PatchFunctions.UpdateWrapper (System.Reflection.MethodBase original, HarmonyLib.PatchInfo patchInfo) [0x00057] in <88b084d277f344aa9c2904c640976875>:0 
  at HarmonyLib.PatchProcessor.Patch () [0x000fc] in <88b084d277f344aa9c2904c640976875>:0 
  at HarmonyLib.Harmony.Patch (System.Reflection.MethodBase original, HarmonyLib.HarmonyMethod prefix, HarmonyLib.HarmonyMethod postfix, HarmonyLib.HarmonyMethod transpiler, HarmonyLib.HarmonyMethod finalizer) [0x00028] in <88b084d277f344aa9c2904c640976875>:0 
  at Needle.HybridPackages.PackagerPatchProvider.OnGetPatches () [0x00041] in ./Library/PackageCache/[email protected]/Editor/AssetStoreToolsExtension.cs:71 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <4fdeffda907b481796507bee174be5e3>:0 
   --- End of inner exception stack trace ---
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00083] in <4fdeffda907b481796507bee174be5e3>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <4fdeffda907b481796507bee174be5e3>:0 
  at UnityEditor.EditorAssemblies.ProcessInitializeOnLoadMethodAttributes () [0x000a5] in /Users/bokken/build/output/unity/unity/Editor/Mono/EditorAssemblies.cs:166 
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadMethodAttributes () (at /Users/bokken/build/output/unity/unity/Editor/Mono/EditorAssemblies.cs:170)

cecarlsen avatar Feb 06 '23 18:02 cecarlsen

Hi, haven't seen that one yet. Does it happen in an empty project as well, and does it change when you disable Assembly Validation in the project settings?

hybridherbst avatar Feb 10 '23 17:02 hybridherbst

I just tried importing the package in an empty project (2022.2.5f1) with no other packages and I get the same error.

I can't find the Assembly Validation setting in the Project Settings. Do you mean PlayerSettings.assemblyVersionValidation?

cecarlsen avatar Feb 10 '23 18:02 cecarlsen