GithubHelp home page GithubHelp logo

focus-creative-games / hybridclr Goto Github PK

View Code? Open in Web Editor NEW
5.7K 83.0 619.0 11 MB

HybridCLR是一个特性完整、零成本、高性能、低内存的Unity全平台原生c#热更新解决方案。 HybridCLR is a fully featured, zero-cost, high-performance, low-memory solution for Unity's all-platform native c# hotupdate.

Home Page: https://code-philosophy.com/

License: MIT License

C++ 100.00% C 0.01%
csharp hotupdate huatuo il2cpp unity hotfix hot-update ios framework hot

hybridclr's People

Contributors

alanliu90 avatar pirunxi avatar rigyuki avatar roland0511 avatar senfee-cheng avatar shuaigao avatar ya0guang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hybridclr's Issues

MachineState 内存泄漏问题

看代码的时候,发现 MachineState 没有地方释放,并且析构函数中 _frameBase 和 _exceptionFlowBase 也没有释放。
用 Unity 2020.3.33+Win64,运行下面的代码,内存会不断增长:

void Start()
{
	StartCoroutine(Test());
}

IEnumerator Test()
{
	Thread[] threads = new Thread[4];

	while (true)
	{
		for (int i = 0; i < threads.Length; ++i)
		{
			Thread t = new Thread(Run);
			threads[i] = t;
			t.Start();
		}

		for (int i = 0; i < threads.Length; ++i)
		{
			threads[i].Join();
			threads[i] = null;
		}

		yield return new WaitForSeconds(5);
	}
}

void Run()
{
	Thread.Sleep(1);
}

我自己尝试改了下代码验证,发现确实是 MachineState 没释放导致的:

--- a/hybridclr/interpreter/Engine.h
+++ b/hybridclr/interpreter/Engine.h
@@ -56,6 +56,8 @@ namespace interpreter
 
 		~MachineState()
 		{
+			IL2CPP_FREE(_exceptionFlowBase);
+			IL2CPP_FREE(_frameBase);
 			il2cpp::gc::GarbageCollector::FreeFixed(_stackBase);
 		}

--- a/hybridclr/interpreter/InterpreterModule.h
+++ b/hybridclr/interpreter/InterpreterModule.h
@@ -19,6 +19,7 @@ namespace interpreter
 
 
 		static MachineState& GetCurrentThreadMachineState();
+		static void ClearCurrentThreadMachineState();
 
 		static InterpMethodInfo* GetInterpMethodInfo(const MethodInfo* methodInfo);

--- a/hybridclr/interpreter/InterpreterModule.cpp
+++ b/hybridclr/interpreter/InterpreterModule.cpp
@@ -38,6 +38,18 @@ namespace hybridclr
 			return *state;
 		}
 
+		void InterpreterModule::ClearCurrentThreadMachineState()
+		{
+			MachineState* state = nullptr;
+			s_machineState.GetValue((void**)&state);
+
+			if (state)
+			{
+				s_machineState.SetValue(nullptr);
+				delete state;
+			}
+		}
+
 		void InterpreterModule::Initialize()
 		{
 			for (size_t i = 0; ; i++)
--- a/libil2cpp/vm/Thread.cpp
+++ b/libil2cpp/vm/Thread.cpp
@@ -29,6 +29,8 @@
 #include "Cpp/Atomic.h"
 #include "Cpp/ReentrantLock.h"
 
+#include "hybridclr/interpreter/InterpreterModule.h"
+
 #if IL2CPP_MONO_DEBUGGER
 
 extern "C" {
@@ -355,6 +357,8 @@ namespace vm
 
         Uninitialize(thread);
         il2cpp::vm::StackTrace::CleanupStackTracesForCurrentThread();
+
+        hybridclr::interpreter::InterpreterModule::ClearCurrentThreadMachineState();
     }
 
     Il2CppThread* Thread::Main()
@@ -730,6 +734,8 @@ namespace vm
                 il2cpp::vm::Thread::Uninitialize(startData->m_Thread);
 
             il2cpp::vm::StackTrace::CleanupStackTracesForCurrentThread();
+
+            hybridclr::interpreter::InterpreterModule::ClearCurrentThreadMachineState();
         }
 
         delete startData->m_Semaphore;

--- a/libil2cpp/icalls/mscorlib/System.Threading/Thread.cpp
+++ b/libil2cpp/icalls/mscorlib/System.Threading/Thread.cpp
@@ -20,6 +20,8 @@
 #include "utils/Memory.h"
 #include "utils/StringUtils.h"
 
+#include "hybridclr/interpreter/InterpreterModule.h"
+
 using il2cpp::gc::GarbageCollector;
 
 namespace il2cpp
@@ -169,6 +171,8 @@ namespace Threading
             il2cpp::vm::Thread::Uninitialize(startData->m_Thread);
 
             il2cpp::vm::StackTrace::CleanupStackTracesForCurrentThread();
+
+            hybridclr::interpreter::InterpreterModule::ClearCurrentThreadMachineState();
         }
 
         delete startData->m_Semaphore;

Assembly.Load加载hotfix.dll时报错

unity editor版本:2021.3.10f1c1
操作系统:Windows 11 专业版
Build Target:Windows 64bit
com.focus-creative-games.hybridclr_unity的版本号:1.1.4
git main分支更新到:支持自定义外部热更新dll的搜索路径 externalHotUpdateAssembliyDirs walon [email protected] abc70a7ffc52c795dc3f8fe32c7151d05c2c49c2 2022/12/2 10:33:13
复现条件:只要把我上传的代码加进hotfix.dll里,运行到Assembly.Load加载hotfix.dll就会报错
Kcp.zip

触发断言:gi->type_argc <= 32

环境

Unity: 2020.3.42
il2cpp_plus: 2020-DHE
hybridclr: DHE
hybridclr_unity: DHE
OS+Build: Windows 10 64 bit

问题

在dhe_demo中使用下面的代码可以复现问题:

public class Case5
{
    public class A<T>
    {
        public virtual string Run1()
        {
            return "A: " + typeof(T);
        }
    }

    public class B
    {
    }

    public struct C
    {
    }

    public static void Run()
    {
        A<B> a1 = new A<B>();
        Debug.Log(a1.Run1());

        A<C> a2 = new A<C>();
        Debug.Log(a2.Run1());
    }
}

void Start()
{

	// Run("函数未变化,运行AOT版本", RunNotChangedMethod);
	// Run("函数有变化,运行解释器版本", RunChangedMethod);

	Case5.Run();
}

触发的断言:

gi->type_argc <= 32 (DifferentialHybridImage.cpp Line: 304)

DHE:使用泛型导致崩溃

环境

Unity 2020.3.33
il2cpp_plus 2020-DHE
hybridclr DHE
hybridclr_unity DHE
OS+Build Windows 10 64 bit
project dhe_demo(没开间接函数优化)

问题

下面代码可复现:

public abstract class A<T>
{
    public List<T> D = new List<T>();
}

public class B<T1, T2> : A<Action<T1, T2>>
{

}

public class C
{

}

public class HotUpdateMain : MonoBehaviour
{
    public B<C, C> B = new B<C, C>();

    void Start()
    {
        UnityEngine.Debug.Log(B.D.Count);
    }
}

崩溃信息:

Exception thrown: read access violation.method->klass->rgctx_data was nullptr.

崩溃调用栈:

GameAssembly.dll!A_1__ctor_mEED8058ABFA500A40294771CB8E97D19EE7AB818_gshared(A_1_t07D96EE2B9CE8B3CD0D4BD89B30F9AC917BB780B * __this, const MethodInfo * method) Line 10606	C++
GameAssembly.dll!B_2__ctor_m60BC8C51983FF411DB5E772CEBC95CD7AB257757_gshared(B_2_t2654A0DA705819C42DC5558AE9A2DD5159BB992D * __this, const MethodInfo * method) Line 36301	C++
GameAssembly.dll!B_2__ctor_mF25B031406C1FDBCB812BCD1EDC944C8771F76BB(B_2_t0B5CD9A23C3DA938F788BE1B5E0E6CACD5A75F16 * __this, const MethodInfo * method) Line 854	C++
GameAssembly.dll!HotUpdateMain__ctor_m5549897CFBEE17CCA2EBEFF1DE62E41891423004(HotUpdateMain_t9691E9193AC822C20C46ED6B1C1F26EEB0EC8F21 * __this, const MethodInfo * method) Line 1223	C++
GameAssembly.dll!RuntimeInvoker_TrueVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5(void(*)() methodPointer, const MethodInfo * methodMetadata, void * obj, void * * args) Line 28206	C++
GameAssembly.dll!il2cpp::vm::Runtime::Invoke(const MethodInfo * method, void * obj, void * * params, Il2CppException * * exc) Line 559	C++
GameAssembly.dll!il2cpp::vm::Runtime::ObjectInitException(Il2CppObject * object, Il2CppException * * exc) Line 600	C++
GameAssembly.dll!il2cpp_runtime_object_init_exception(Il2CppObject * obj, Il2CppException * * exc) Line 1133	C++
UnityPlayer.dll!scripting_unity_engine_object_new_and_invoke_default_constructor(class ScriptingClassPtr,class Object *,class ScriptingExceptionPtr *)	Unknown
UnityPlayer.dll!SerializableManagedRef::RebuildMonoInstance(class Object *,class ScriptingClassPtr,class ScriptingObjectPtr,class MonoScript *)	Unknown

几个DHE问题(4)

环境

Unity 2020.3.33
il2cpp_plus 2020-DHE
hybridclr DHE
hybridclr_unity DHE
OS+Build Windows 10 64 bit
project dhe_demo(没开间接函数优化)

问题1

类的虚表中,存在2份接口函数,多出来的一份占用了后面虚函数的槽,导致要调用虚函数时,调用成了接口方法,下面的代码可复现问题:

public interface IMessagePackSerializationCallbackReceiver
{
    void OnBeforeSerialize();
    void OnAfterDeserialize();
}

public class B
{
    public float X;
}

public class A : IMessagePackSerializationCallbackReceiver
{
    public B Info;

    public void OnBeforeSerialize()
    {
    }

    public void OnAfterDeserialize()
    {
        Info = Func();
    }

    protected virtual B Func()
    {
        return new B() { X = 1 };
    }
}

public class Case22
{
    public static void Run()
    {
        var a= new A();
        a.OnAfterDeserialize();

        UnityEngine.Debug.Log(a.Info.X);
    }
}

void Start()
{
	Case22.Run();
}

期望输出:1
实际输出:-5.758993E-11

问题2

DifferentialHybridImage::IsDHETypeEqual中,递归调用IsDHETypeEqual的地方,参数都颠倒了,导致可以用AOT版本执行的函数,变成了解释执行

问题3

修改热更dll中的函数后,执行时抛异常:NotSupportNative2Managed,下面代码可复现:

// 在Main工程中添加
public class A
{
    private Func<object, object> mFunc;

    public void Register<T, TResult>(Func<T, TResult> callback)
    {
        mFunc = (obj) => callback((T)obj);
    }

    public void Invoke<T>(T t)
    {
        mFunc?.Invoke(t);
    }
}

// 在Assembly-CSharp工程添加
public class B
{
    public static Vector3 Test(bool f)
    {
#if DHE_HOT_UPDATE
        UnityEngine.Debug.Log("Test1: " + f);
#else
        UnityEngine.Debug.Log("Test2: " + f);
#endif

        return Vector3.one;
    }
}

public class HotUpdateMain : MonoBehaviour
{
    void Start()
    {
        var a = new A();
        a.Register<bool, Vector3>(B.Test);
        a.Invoke(false);
    }
}

期望输出:Test1: False
实际输出:ExecutionEngineException: NotSupportNative2Managed

ENABLE_PLACEHOLDER_DLL关闭可能会编译报错

Assembly.cpp中
Il2CppAssembly* Assembly::Create(const byte* assemblyData, uint64_t length, bool copyData)中调用的FindPlaceHolderAssembly声明&实现都是被包在#if ENABLE_PLACEHOLDER_DLL == 1中。
如果删除了Il2CppCompatibleDef.h中删除了#define ENABLE_PLACEHOLDER_DLL 1
这样编译时会引起找不到函数的错误

是否无法进行Profiler真机调试的打包

勾选了BuildSettings的
Development Build
AutoConnect Profiler
Deep Profiling Support
Script Debugging
打包报错
`Exception: Unity.IL2CPP.Building.BuilderFailedException: D:\Program Files\Unity\Hub\Editor\2020.3.33f1c2\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++ @"C:\Users\SHDTY\AppData\Local\Temp\tmp2691.tmp" -o "C:\Users\SHDTY\Desktop\Example\Client2020333\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_6B9F27354AC80744EDA767CE9AB4712F\libil2cpp.so" -shared -Wl,-soname,libil2cpp.so -Wl,--no-undefined -Wl,-z,noexecstack -Wl,--gc-sections -Wl,--build-id -stdlib=libc++ -static-libstdc++ -target armv7-linux-androideabi19 -Wl,--wrap,sigaction "D:\Program Files\Unity\Hub\Editor\2020.3.33f1c2\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp\Development\StaticLibs\armeabi-v7a\baselib.a" -llog -rdynamic -fuse-ld=gold.exe

C:\Users\SHDTY\Desktop\Example\Client2020333\HybridCLRData\LocalIl2CppData\il2cpp\libil2cpp\vm-utils/Debugger.cpp:250: error: undefined reference to 'mono_debugger_agent_init_minimal'
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)

at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet1 objectFiles, CppToolChainContext toolChainContext) at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection1 matchedAssemblyMethodSourceFiles)
at il2cpp.Program.DoRun(String[] args, RuntimePlatform platform, BuildingOptions buildingOptions, Boolean throwExceptions)
UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at <8d4895b259be41298a685a0c9b423575>:0)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at <8d4895b259be41298a685a0c9b423575>:0) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List1[T] arguments, System.Action1[T] setupStartInfo) (at <8d4895b259be41298a685a0c9b423575>:0) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data) (at <8d4895b259be41298a685a0c9b423575>:0) UnityEditorInternal.IL2CPPBuilder.Run () (at <8d4895b259be41298a685a0c9b423575>:0) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <8d4895b259be41298a685a0c9b423575>:0)
UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5c66c398f62f41bd9a3f1a9c5e45d135>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5c66c398f62f41bd9a3f1a9c5e45d135>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <5c66c398f62f41bd9a3f1a9c5e45d135>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <5c66c398f62f41bd9a3f1a9c5e45d135>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <8d4895b259be41298a685a0c9b423575>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
`

几个DHE问题(2)

环境

Unity 2020.3.33
il2cpp_plus 2020-DHE
hybridclr DHE
hybridclr_unity DHE
OS+Build Windows 10 64 bit
project dhe_demo (没开间接函数优化)

问题1

计算等价性时,报错:

NullReferenceException: Object reference not set to an instance of an object
HybridCLR.Editor.DHE.MethodCompareCache.CompareExceptionHandler (dnlib.DotNet.Emit.ExceptionHandler e1, dnlib.DotNet.Emit.ExceptionHandler e2) (at Library/PackageCache/com.focus-creative-games.hybridclr_unity@8c290d286c/Editor/DHE/MethodCompareCache.cs:590)

复现代码:

class A
{
    private object mLock = new object();

    public void Func1()
    {
        lock (mLock)
        {
            var e = Func2();
            if (e != null)
                throw e;

            throw new InvalidOperationException("xxxx");
        }
    }

    private Exception Func2()
    {
        return null;
    }
}

问题2

没有变化的函数,被计算为不等价,复现代码:

class A<T> where T : UnityEngine.Object
{
    private UnityEngine.Object mObject;

    public A(UnityEngine.Object obj)
    {
        mObject = obj;
    }

    public T Object
    {
        get
        {
            return mObject as T;
        }
    }
}

输出:change mehtod:T A`1::get_Object() token:100663298

问题3

多线程情况下,GetRuntimeMetadataIl2CppType中,可能创建多个相同的dhType

问题4

s_dheTypesil2cpp::vm::GlobalMetadata::Clear中没有释放

calli 的实现问题

看 calli 实现的时候,发现 Image::ReadStandAloneSig 中,params 没有赋值给 methodSig.params。我自己本地尝试修复时,还发现了其他问题,感觉 cali 的实现可能没有测过,hybridclr_test 也没看到相关的测试用例。

这里写下我的测试方法,希望能提供帮助。

  1. 在nuget下载runtime.win-x64.microsoft.netcore.ilasm.6.0.0.nupkg,解压可以拿到 ilasm.exe
  2. 为下面的IL代码(保存到 il.txt 文件中),生成 Assembly:ilasm /DLL il.txt /OUTPUT=MyTest.dll
  3. 把 MyTest.dll 放到Unity工程中,当作 Hotfix dll
  4. 以 hybridclr_trial 为例,在 Assembly-CSharp 中,调用 A.TestCalli()
  5. 修改代码,让打包版本可以加载到 MyTest.dll
  6. 运行Win64版本,会看到程序触发了断言
.assembly extern mscorlib
{
    auto
}
.assembly MyTest {}
.module MyTest.dll
.class public A
{
    .method public specialname void .ctor()
    {
        ldarg.0
        call instance void [mscorlib]System.Object::.ctor()
        ret
    }
    
    .method public static void Test2(int32 param_0)
    {
        ldarg.0
		box [mscorlib]System.Int32
        call void [UnityEngine.CoreModule]UnityEngine.Debug::Log(object)
        ret
    }
	
	.method public static void TestCalli()
	{
		.locals (class A a,int32 v_1)

		ldftn void A::Test2(int32)
		stloc.1
		ldc.i4 123
		ldloc.1
		calli void(int32)

		ret
	}  
}

RequireComponent不被调用

  • Unity Editor版本。2020.3.33f1c2
  • 操作系统。 Win 10
  • 出错的Build Target。win64。
  • com.focus-creative-games.hybridclr_unity的版本号 Version 1.1.15
  • 仓库版本号
    image

问题描述:
脚本Gan添加[RequireComponent(typeof(Player))]属性,在HotUpdateMain中 gameObject.AddComponent();发现Player并未加载。

偶尔会有crash,平台win32,没有用development build,unity版本2021.3.1f1,加载assetbundle的场景后偶尔会崩

Crash!!!
SymInit: Symbol-SearchPath: '.;D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project;D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project;C:\Windows;C:\Windows\system32;SRVC:\websymbolshttp://msdl.microsoft.com/download/', symOptions: 534, UserName: 'PC'
OS-Version: 10.0.0
D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project\zbasketball_st.exe:zbasketball_st.exe (00280000), size: 655360 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2021.2.6.28601
C:\Windows\SYSTEM32\ntdll.dll:ntdll.dll (77170000), size: 1720320 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1806
C:\Windows\System32\KERNEL32.DLL:KERNEL32.DLL (76AD0000), size: 983040 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1889
C:\Windows\System32\KERNELBASE.dll:KERNELBASE.dll (76E80000), size: 2199552 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1889
D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project\UnityPlayer.dll:UnityPlayer.dll (7A430000), size: 23166976 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2021.3.1.28832
C:\Windows\System32\USER32.dll:USER32.dll (76750000), size: 1687552 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1889
C:\Windows\System32\win32u.dll:win32u.dll (75740000), size: 98304 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1889
C:\Windows\System32\GDI32.dll:GDI32.dll (75070000), size: 143360 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1620
C:\Windows\System32\gdi32full.dll:gdi32full.dll (769F0000), size: 901120 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1865
C:\Windows\System32\msvcp_win.dll:msvcp_win.dll (750A0000), size: 503808 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.789
C:\Windows\System32\ucrtbase.dll:ucrtbase.dll (75D70000), size: 1179648 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.789
C:\Windows\System32\ole32.dll:ole32.dll (75BB0000), size: 929792 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1202
C:\Windows\System32\RPCRT4.dll:RPCRT4.dll (770A0000), size: 778240 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1806
C:\Windows\System32\combase.dll:combase.dll (764B0000), size: 2617344 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1741
C:\Windows\System32\SHLWAPI.dll:SHLWAPI.dll (75AE0000), size: 282624 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1706
C:\Windows\System32\msvcrt.dll:msvcrt.dll (75680000), size: 782336 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 7.0.19041.546
C:\Windows\SYSTEM32\VERSION.dll:VERSION.dll (75030000), size: 32768 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\System32\SETUPAPI.dll:SETUPAPI.dll (751E0000), size: 4427776 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1741
C:\Windows\System32\cfgmgr32.dll:cfgmgr32.dll (75D30000), size: 241664 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1620
C:\Windows\System32\bcrypt.dll:bcrypt.dll (76730000), size: 102400 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1023
C:\Windows\System32\ADVAPI32.dll:ADVAPI32.dll (75760000), size: 503808 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1682
C:\Windows\System32\sechost.dll:sechost.dll (757E0000), size: 483328 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1865
C:\Windows\System32\SHELL32.dll:SHELL32.dll (75EF0000), size: 5988352 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1806
C:\Windows\System32\OLEAUT32.dll:OLEAUT32.dll (76DE0000), size: 614400 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.985
C:\Windows\System32\IMM32.dll:IMM32.dll (75040000), size: 151552 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\System32\CRYPT32.dll:CRYPT32.dll (75870000), size: 1024000 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1889
C:\Windows\System32\WS2_32.dll:WS2_32.dll (75120000), size: 405504 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\OPENGL32.dll:OPENGL32.dll (51180000), size: 1064960 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1806
C:\Windows\SYSTEM32\WINMM.dll:WINMM.dll (72920000), size: 163840 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\WINHTTP.dll:WINHTTP.dll (72D70000), size: 823296 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1682
C:\Windows\SYSTEM32\HID.DLL:HID.DLL (6FEC0000), size: 40960 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\dwmapi.dll:dwmapi.dll (69E20000), size: 155648 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.746
C:\Windows\SYSTEM32\GLU32.dll:GLU32.dll (7C1B0000), size: 258048 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1806
C:\Windows\SYSTEM32\kernel.appcore.dll:kernel.appcore.dll (73F60000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\System32\bcryptPrimitives.dll:bcryptPrimitives.dll (75CA0000), size: 389120 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1415
C:\Windows\system32\uxtheme.dll:uxtheme.dll (6DEE0000), size: 475136 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1620
C:\Windows\System32\shcore.dll:shcore.dll (76BC0000), size: 552960 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1645
C:\Windows\SYSTEM32\windows.storage.dll:windows.storage.dll (74930000), size: 6340608 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1865
C:\Windows\SYSTEM32\Wldp.dll:Wldp.dll (74860000), size: 159744 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1806
C:\Windows\SYSTEM32\profapi.dll:profapi.dll (73D20000), size: 98304 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.844
D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project\GameAssembly.dll:GameAssembly.dll (06820000), size: 46481408 (result: 0), SymType: '-deferred-', PDB: ''
D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project\baselib.dll:baselib.dll (7C1F0000), size: 335872 (result: 0), SymType: '-deferred-', PDB: ''
C:\Windows\SYSTEM32\IPHLPAPI.DLL:IPHLPAPI.DLL (741C0000), size: 204800 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\dbghelp.dll:dbghelp.dll (737A0000), size: 1605632 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1052
C:\Windows\System32\MSCTF.dll:MSCTF.dll (76D00000), size: 868352 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1806
C:\Windows\SYSTEM32\d3d11.dll:d3d11.dll (6D630000), size: 1966080 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1865
C:\Windows\SYSTEM32\dxgi.dll:dxgi.dll (6FD30000), size: 798720 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1806
C:\Windows\System32\DriverStore\FileRepository\nv_dispig.inf_amd64_df0bee9f4cb9436e\nvldumd.dll:nvldumd.dll (567F0000), size: 888832 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 30.0.15.1215
C:\Windows\SYSTEM32\msasn1.dll:msasn1.dll (73C00000), size: 57344 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\cryptnet.dll:cryptnet.dll (69230000), size: 155648 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.906
C:\Windows\SYSTEM32\drvstore.dll:drvstore.dll (69130000), size: 1048576 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1566
C:\Windows\SYSTEM32\devobj.dll:devobj.dll (71170000), size: 147456 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1620
C:\Windows\SYSTEM32\cryptbase.dll:cryptbase.dll (73C10000), size: 40960 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\System32\WINTRUST.DLL:WINTRUST.DLL (75190000), size: 315392 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1865
C:\Windows\System32\imagehlp.dll:imagehlp.dll (75D00000), size: 102400 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1415
C:\Windows\SYSTEM32\CRYPTSP.dll:CRYPTSP.dll (73C50000), size: 77824 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\system32\rsaenh.dll:rsaenh.dll (73C20000), size: 192512 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1052
C:\Windows\System32\DriverStore\FileRepository\nv_dispig.inf_amd64_df0bee9f4cb9436e\nvwgf2um.dll:nvwgf2um.dll (11E80000), size: 35528704 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 30.0.15.1215
C:\Windows\SYSTEM32\dxcore.dll:dxcore.dll (6FD00000), size: 180224 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\System32\clbcatq.dll:clbcatq.dll (75B30000), size: 516096 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2001.12.10941.16384
C:\Windows\system32\wbem\wbemprox.dll:wbemprox.dll (6AD40000), size: 53248 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1320
C:\Windows\SYSTEM32\wbemcomn.dll:wbemcomn.dll (6ACD0000), size: 458752 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1566
C:\Windows\system32\wbem\wbemsvc.dll:wbemsvc.dll (6ABA0000), size: 65536 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1320
C:\Windows\system32\wbem\fastprox.dll:fastprox.dll (6AAD0000), size: 823296 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\amsi.dll:amsi.dll (6AAB0000), size: 102400 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1620
C:\Windows\SYSTEM32\USERENV.dll:USERENV.dll (75000000), size: 151552 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.572
C:\Program Files (x86)\Windows Defender\MpOav.dll:MpOav.dll (6AA70000), size: 229376 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 4.18.1909.6
C:\Windows\System32\MMDevApi.dll:MMDevApi.dll (6FAA0000), size: 438272 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1503
C:\Windows\SYSTEM32\AUDIOSES.DLL:AUDIOSES.DLL (5A950000), size: 1269760 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1741
C:\Windows\SYSTEM32\powrprof.dll:powrprof.dll (6C700000), size: 278528 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\UMPDC.dll:UMPDC.dll (74890000), size: 53248 (result: 0), SymType: '-deferred-', PDB: ''
C:\Windows\SYSTEM32\resourcepolicyclient.dll:resourcepolicyclient.dll (5A6C0000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\xinput9_1_0.dll:xinput9_1_0.dll (56910000), size: 28672 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1
C:\Windows\SYSTEM32\dcomp.dll:dcomp.dll (69FE0000), size: 1462272 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1741
C:\Windows\SYSTEM32\textinputframework.dll:textinputframework.dll (67430000), size: 757760 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1741
C:\Windows\SYSTEM32\CoreMessaging.dll:CoreMessaging.dll (67110000), size: 634880 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.867
C:\Windows\SYSTEM32\CoreUIComponents.dll:CoreUIComponents.dll (671B0000), size: 2613248 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\ntmarta.dll:ntmarta.dll (73F70000), size: 167936 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\wintypes.dll:wintypes.dll (67030000), size: 897024 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1682
C:\Windows\system32\napinsp.dll:napinsp.dll (73480000), size: 69632 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\system32\pnrpnsp.dll:pnrpnsp.dll (73460000), size: 90112 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\system32\wshbth.dll:wshbth.dll (73450000), size: 65536 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\system32\NLAapi.dll:NLAapi.dll (733F0000), size: 90112 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\System32\mswsock.dll:mswsock.dll (73BA0000), size: 335872 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\DNSAPI.dll:DNSAPI.dll (73360000), size: 589824 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1865
C:\Windows\System32\NSI.dll:NSI.dll (75D20000), size: 28672 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.610
C:\Windows\System32\winrnr.dll:winrnr.dll (73350000), size: 57344 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\System32\rasadhlp.dll:rasadhlp.dll (73340000), size: 32768 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\System32\fwpuclnt.dll:fwpuclnt.dll (730E0000), size: 364544 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1682
C:\Windows\SYSTEM32\gpapi.dll:gpapi.dll (711A0000), size: 122880 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.572
C:\Windows\SYSTEM32\dhcpcsvc6.DLL:dhcpcsvc6.DLL (710E0000), size: 81920 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\dhcpcsvc.DLL:dhcpcsvc.DLL (73C70000), size: 90112 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\SspiCli.dll:SspiCli.dll (72850000), size: 135168 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.19041.1586

========== OUTPUTTING STACK TRACE ==================

0x06A221A6 (GameAssembly) [c:\jenkins\workspace\basketball_client_win_alpha\project\assets\framework_hotfix\third_party\hybridclr\hybridclrdata~\localil2cppdata\il2cpp\libil2cpp\vm\class.cpp:834] il2cpp::vm::Class::IsValuetype
0x069C317D (GameAssembly) [c:\jenkins\workspace\basketball_client_win_alpha\project\assets\framework_hotfix\third_party\hybridclr\hybridclrdata~\localil2cppdata\il2cpp\libil2cpp\vm\liveness.cpp:405] il2cpp::vm::LivenessState::TraverseArray
0x069C3587 (GameAssembly) [c:\jenkins\workspace\basketball_client_win_alpha\project\assets\framework_hotfix\third_party\hybridclr\hybridclrdata~\localil2cppdata\il2cpp\libil2cpp\vm\liveness.cpp:265] il2cpp::vm::LivenessState::TraverseObjects
SymInit: Symbol-SearchPath: '.;D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project;D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project;C:\Windows;C:\Windows\system32;SRVC:\websymbolshttp://msdl.microsoft.com/download/', symOptions: 534, UserName: 'PC'
OS-Version: 10.0.0
D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project\zbasketball_st.exe:zbasketball_st.exe (00280000), size: 655360 (result: 0), SymType: '-exported-', PDB: 'D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project\zbasketball_st', fileVersion: 2021.2.6.28601
C:\Windows\SYSTEM32\ntdll.dll:ntdll.dll (77170000), size: 1720320 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\ntdll.dll', fileVersion: 10.0.19041.1806
C:\Windows\System32\KERNEL32.DLL:KERNEL32.DLL (76AD0000), size: 983040 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\KERNEL32.DLL', fileVersion: 10.0.19041.1889
C:\Windows\System32\KERNELBASE.dll:KERNELBASE.dll (76E80000), size: 2199552 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\KERNELBASE.dll', fileVersion: 10.0.19041.1889
D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project\UnityPlayer.dll:UnityPlayer.dll (7A430000), size: 23166976 (result: 0), SymType: '-exported-', PDB: 'D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project\UnityPlayer', fileVersion: 2021.3.1.28832
C:\Windows\System32\USER32.dll:USER32.dll (76750000), size: 1687552 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\USER32.dll', fileVersion: 10.0.19041.1889
C:\Windows\System32\win32u.dll:win32u.dll (75740000), size: 98304 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\win32u.dll', fileVersion: 10.0.19041.1889
C:\Windows\System32\GDI32.dll:GDI32.dll (75070000), size: 143360 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\GDI32.dll', fileVersion: 10.0.19041.1620
C:\Windows\System32\gdi32full.dll:gdi32full.dll (769F0000), size: 901120 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\gdi32full.dll', fileVersion: 10.0.19041.1865
C:\Windows\System32\msvcp_win.dll:msvcp_win.dll (750A0000), size: 503808 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\msvcp_win.dll', fileVersion: 10.0.19041.789
C:\Windows\System32\ucrtbase.dll:ucrtbase.dll (75D70000), size: 1179648 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\ucrtbase.dll', fileVersion: 10.0.19041.789
C:\Windows\System32\ole32.dll:ole32.dll (75BB0000), size: 929792 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\ole32.dll', fileVersion: 10.0.19041.1202
C:\Windows\System32\RPCRT4.dll:RPCRT4.dll (770A0000), size: 778240 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\RPCRT4.dll', fileVersion: 10.0.19041.1806
C:\Windows\System32\combase.dll:combase.dll (764B0000), size: 2617344 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\combase.dll', fileVersion: 10.0.19041.1741
C:\Windows\System32\SHLWAPI.dll:SHLWAPI.dll (75AE0000), size: 282624 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\SHLWAPI.dll', fileVersion: 10.0.19041.1706
C:\Windows\System32\msvcrt.dll:msvcrt.dll (75680000), size: 782336 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\msvcrt.dll', fileVersion: 7.0.19041.546
C:\Windows\SYSTEM32\VERSION.dll:VERSION.dll (75030000), size: 32768 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\VERSION.dll', fileVersion: 10.0.19041.546
C:\Windows\System32\SETUPAPI.dll:SETUPAPI.dll (751E0000), size: 4427776 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\SETUPAPI.dll', fileVersion: 10.0.19041.1741
C:\Windows\System32\cfgmgr32.dll:cfgmgr32.dll (75D30000), size: 241664 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\cfgmgr32.dll', fileVersion: 10.0.19041.1620
C:\Windows\System32\bcrypt.dll:bcrypt.dll (76730000), size: 102400 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\bcrypt.dll', fileVersion: 10.0.19041.1023
C:\Windows\System32\ADVAPI32.dll:ADVAPI32.dll (75760000), size: 503808 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\ADVAPI32.dll', fileVersion: 10.0.19041.1682
C:\Windows\System32\sechost.dll:sechost.dll (757E0000), size: 483328 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\sechost.dll', fileVersion: 10.0.19041.1865
C:\Windows\System32\SHELL32.dll:SHELL32.dll (75EF0000), size: 5988352 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\SHELL32.dll', fileVersion: 10.0.19041.1806
C:\Windows\System32\OLEAUT32.dll:OLEAUT32.dll (76DE0000), size: 614400 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\OLEAUT32.dll', fileVersion: 10.0.19041.985
C:\Windows\System32\IMM32.dll:IMM32.dll (75040000), size: 151552 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\IMM32.dll', fileVersion: 10.0.19041.546
C:\Windows\System32\CRYPT32.dll:CRYPT32.dll (75870000), size: 1024000 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\CRYPT32.dll', fileVersion: 10.0.19041.1889
C:\Windows\System32\WS2_32.dll:WS2_32.dll (75120000), size: 405504 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\WS2_32.dll', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\OPENGL32.dll:OPENGL32.dll (51180000), size: 1064960 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\OPENGL32.dll', fileVersion: 10.0.19041.1806
C:\Windows\SYSTEM32\WINMM.dll:WINMM.dll (72920000), size: 163840 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\WINMM.dll', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\WINHTTP.dll:WINHTTP.dll (72D70000), size: 823296 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\WINHTTP.dll', fileVersion: 10.0.19041.1682
C:\Windows\SYSTEM32\HID.DLL:HID.DLL (6FEC0000), size: 40960 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\HID.DLL', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\dwmapi.dll:dwmapi.dll (69E20000), size: 155648 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\dwmapi.dll', fileVersion: 10.0.19041.746
C:\Windows\SYSTEM32\GLU32.dll:GLU32.dll (7C1B0000), size: 258048 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\GLU32.dll', fileVersion: 10.0.19041.1806
C:\Windows\SYSTEM32\kernel.appcore.dll:kernel.appcore.dll (73F60000), size: 61440 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\kernel.appcore.dll', fileVersion: 10.0.19041.546
C:\Windows\System32\bcryptPrimitives.dll:bcryptPrimitives.dll (75CA0000), size: 389120 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\bcryptPrimitives.dll', fileVersion: 10.0.19041.1415
C:\Windows\system32\uxtheme.dll:uxtheme.dll (6DEE0000), size: 475136 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\uxtheme.dll', fileVersion: 10.0.19041.1620
C:\Windows\System32\shcore.dll:shcore.dll (76BC0000), size: 552960 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\shcore.dll', fileVersion: 10.0.19041.1645
C:\Windows\SYSTEM32\windows.storage.dll:windows.storage.dll (74930000), size: 6340608 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\windows.storage.dll', fileVersion: 10.0.19041.1865
C:\Windows\SYSTEM32\Wldp.dll:Wldp.dll (74860000), size: 159744 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\Wldp.dll', fileVersion: 10.0.19041.1806
C:\Windows\SYSTEM32\profapi.dll:profapi.dll (73D20000), size: 98304 (result: 0), SymType: '-nosymbols-', PDB: 'C:\Windows\SYSTEM32\profapi.dll', fileVersion: 10.0.19041.844
D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project\GameAssembly.dll:GameAssembly.dll (06820000), size: 46481408 (result: 0), SymType: 'PDB', PDB: 'C:\jenkins\workspace\basketball_client_win_alpha\project\Library\Bee\artifacts\WinPlayerBuildProgram\lcec9\GameAssembly.pdb'
D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project\baselib.dll:baselib.dll (7C1F0000), size: 335872 (result: 0), SymType: '-exported-', PDB: 'D:\Ѹ????d6d0d25fb7a5106735cba406d4d73a51\win_project\baselib'
C:\Windows\SYSTEM32\IPHLPAPI.DLL:IPHLPAPI.DLL (741C0000), size: 204800 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\IPHLPAPI.DLL', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\dbghelp.dll:dbghelp.dll (737A0000), size: 1605632 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\dbghelp.dll', fileVersion: 10.0.19041.1052
C:\Windows\System32\MSCTF.dll:MSCTF.dll (76D00000), size: 868352 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\MSCTF.dll', fileVersion: 10.0.19041.1806
C:\Windows\SYSTEM32\d3d11.dll:d3d11.dll (6D630000), size: 1966080 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\d3d11.dll', fileVersion: 10.0.19041.1865
C:\Windows\SYSTEM32\dxgi.dll:dxgi.dll (6FD30000), size: 798720 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\dxgi.dll', fileVersion: 10.0.19041.1806
C:\Windows\System32\DriverStore\FileRepository\nv_dispig.inf_amd64_df0bee9f4cb9436e\nvldumd.dll:nvldumd.dll (567F0000), size: 888832 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\DriverStore\FileRepository\nv_dispig.inf_amd64_df0bee9f4cb9436e\nvldumd.dll', fileVersion: 30.0.15.1215
C:\Windows\SYSTEM32\msasn1.dll:msasn1.dll (73C00000), size: 57344 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\msasn1.dll', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\cryptnet.dll:cryptnet.dll (69230000), size: 155648 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\cryptnet.dll', fileVersion: 10.0.19041.906
C:\Windows\SYSTEM32\drvstore.dll:drvstore.dll (69130000), size: 1048576 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\drvstore.dll', fileVersion: 10.0.19041.1566
C:\Windows\SYSTEM32\devobj.dll:devobj.dll (71170000), size: 147456 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\devobj.dll', fileVersion: 10.0.19041.1620
C:\Windows\SYSTEM32\cryptbase.dll:cryptbase.dll (73C10000), size: 40960 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\cryptbase.dll', fileVersion: 10.0.19041.546
C:\Windows\System32\WINTRUST.DLL:WINTRUST.DLL (75190000), size: 315392 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\WINTRUST.DLL', fileVersion: 10.0.19041.1865
C:\Windows\System32\imagehlp.dll:imagehlp.dll (75D00000), size: 102400 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\imagehlp.dll', fileVersion: 10.0.19041.1415
C:\Windows\SYSTEM32\CRYPTSP.dll:CRYPTSP.dll (73C50000), size: 77824 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\CRYPTSP.dll', fileVersion: 10.0.19041.546
C:\Windows\system32\rsaenh.dll:rsaenh.dll (73C20000), size: 192512 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\rsaenh.dll', fileVersion: 10.0.19041.1052
C:\Windows\System32\DriverStore\FileRepository\nv_dispig.inf_amd64_df0bee9f4cb9436e\nvwgf2um.dll:nvwgf2um.dll (11E80000), size: 35528704 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\DriverStore\FileRepository\nv_dispig.inf_amd64_df0bee9f4cb9436e\nvwgf2um.dll', fileVersion: 30.0.15.1215
C:\Windows\SYSTEM32\dxcore.dll:dxcore.dll (6FD00000), size: 180224 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\dxcore.dll', fileVersion: 10.0.19041.546
C:\Windows\System32\clbcatq.dll:clbcatq.dll (75B30000), size: 516096 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\clbcatq.dll', fileVersion: 2001.12.10941.16384
C:\Windows\system32\wbem\wbemprox.dll:wbemprox.dll (6AD40000), size: 53248 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\wbem\wbemprox.dll', fileVersion: 10.0.19041.1320
C:\Windows\SYSTEM32\wbemcomn.dll:wbemcomn.dll (6ACD0000), size: 458752 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\wbemcomn.dll', fileVersion: 10.0.19041.1566
C:\Windows\system32\wbem\wbemsvc.dll:wbemsvc.dll (6ABA0000), size: 65536 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\wbem\wbemsvc.dll', fileVersion: 10.0.19041.1320
C:\Windows\system32\wbem\fastprox.dll:fastprox.dll (6AAD0000), size: 823296 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\wbem\fastprox.dll', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\amsi.dll:amsi.dll (6AAB0000), size: 102400 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\amsi.dll', fileVersion: 10.0.19041.1620
C:\Windows\SYSTEM32\USERENV.dll:USERENV.dll (75000000), size: 151552 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\USERENV.dll', fileVersion: 10.0.19041.572
C:\Program Files (x86)\Windows Defender\MpOav.dll:MpOav.dll (6AA70000), size: 229376 (result: 0), SymType: '-exported-', PDB: 'C:\Program Files (x86)\Windows Defender\MpOav.dll', fileVersion: 4.18.1909.6
C:\Windows\System32\MMDevApi.dll:MMDevApi.dll (6FAA0000), size: 438272 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\MMDevApi.dll', fileVersion: 10.0.19041.1503
C:\Windows\SYSTEM32\AUDIOSES.DLL:AUDIOSES.DLL (5A950000), size: 1269760 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\AUDIOSES.DLL', fileVersion: 10.0.19041.1741
C:\Windows\SYSTEM32\powrprof.dll:powrprof.dll (6C700000), size: 278528 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\powrprof.dll', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\UMPDC.dll:UMPDC.dll (74890000), size: 53248 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\UMPDC.dll'
C:\Windows\SYSTEM32\resourcepolicyclient.dll:resourcepolicyclient.dll (5A6C0000), size: 61440 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\resourcepolicyclient.dll', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\xinput9_1_0.dll:xinput9_1_0.dll (56910000), size: 28672 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\xinput9_1_0.dll', fileVersion: 10.0.19041.1
C:\Windows\SYSTEM32\dcomp.dll:dcomp.dll (69FE0000), size: 1462272 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\dcomp.dll', fileVersion: 10.0.19041.1741
C:\Windows\SYSTEM32\textinputframework.dll:textinputframework.dll (67430000), size: 757760 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\textinputframework.dll', fileVersion: 10.0.19041.1741
C:\Windows\SYSTEM32\CoreMessaging.dll:CoreMessaging.dll (67110000), size: 634880 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\CoreMessaging.dll', fileVersion: 10.0.19041.867
C:\Windows\SYSTEM32\CoreUIComponents.dll:CoreUIComponents.dll (671B0000), size: 2613248 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\CoreUIComponents.dll', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\ntmarta.dll:ntmarta.dll (73F70000), size: 167936 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\ntmarta.dll', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\wintypes.dll:wintypes.dll (67030000), size: 897024 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\wintypes.dll', fileVersion: 10.0.19041.1682
C:\Windows\system32\napinsp.dll:napinsp.dll (73480000), size: 69632 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\napinsp.dll', fileVersion: 10.0.19041.546
C:\Windows\system32\pnrpnsp.dll:pnrpnsp.dll (73460000), size: 90112 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\pnrpnsp.dll', fileVersion: 10.0.19041.546
C:\Windows\system32\wshbth.dll:wshbth.dll (73450000), size: 65536 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\wshbth.dll', fileVersion: 10.0.19041.546
C:\Windows\system32\NLAapi.dll:NLAapi.dll (733F0000), size: 90112 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\NLAapi.dll', fileVersion: 10.0.19041.546
C:\Windows\System32\mswsock.dll:mswsock.dll (73BA0000), size: 335872 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\mswsock.dll', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\DNSAPI.dll:DNSAPI.dll (73360000), size: 589824 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\DNSAPI.dll', fileVersion: 10.0.19041.1865
C:\Windows\System32\NSI.dll:NSI.dll (75D20000), size: 28672 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\NSI.dll', fileVersion: 10.0.19041.610
C:\Windows\System32\winrnr.dll:winrnr.dll (73350000), size: 57344 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\winrnr.dll', fileVersion: 10.0.19041.546
C:\Windows\System32\rasadhlp.dll:rasadhlp.dll (73340000), size: 32768 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\rasadhlp.dll', fileVersion: 10.0.19041.546
C:\Windows\System32\fwpuclnt.dll:fwpuclnt.dll (730E0000), size: 364544 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\fwpuclnt.dll', fileVersion: 10.0.19041.1682
C:\Windows\SYSTEM32\gpapi.dll:gpapi.dll (711A0000), size: 122880 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\gpapi.dll', fileVersion: 10.0.19041.572
C:\Windows\SYSTEM32\dhcpcsvc6.DLL:dhcpcsvc6.DLL (710E0000), size: 81920 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\dhcpcsvc6.DLL', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\dhcpcsvc.DLL:dhcpcsvc.DLL (73C70000), size: 90112 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\dhcpcsvc.DLL', fileVersion: 10.0.19041.546
C:\Windows\SYSTEM32\SspiCli.dll:SspiCli.dll (72850000), size: 135168 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SYSTEM32\SspiCli.dll', fileVersion: 10.0.19041.1586
ERROR: SymGetSymFromAddr64, GetLastError: '试图访问无效的地址。

' (Address: 7A824CB8)
0x7A824CB8 (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: '试图访问无效的地址。

' (Address: 7A836D92)
0x7A836D92 (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: '试图访问无效的地址。

' (Address: 7A838741)
0x7A838741 (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: '试图访问无效的地址。

' (Address: 7A824155)
0x7A824155 (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: '试图访问无效的地址。

' (Address: 7A8241DE)
0x7A8241DE (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: '试图访问无效的地址。

' (Address: 7A8264D1)
0x7A8264D1 (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: '试图访问无效的地址。

' (Address: 7A9A1D9C)
0x7A9A1D9C (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: '试图访问无效的地址。

' (Address: 7A9A0DF5)
0x7A9A0DF5 (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: '试图访问无效的地址。

' (Address: 7A9A473B)
0x7A9A473B (UnityPlayer) (function-name not available)
0x7A9A5DF5 (UnityPlayer) UnityMain
ERROR: SymGetSymFromAddr64, GetLastError: '试图访问无效的地址。

' (Address: 00281015)
0x00281015 (zbasketball_st) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: '试图访问无效的地址。

' (Address: 002811D9)
0x002811D9 (zbasketball_st) (function-name not available)
0x76AEFA29 (KERNEL32) BaseThreadInitThunk
0x771D7A9E (ntdll) RtlGetAppContainerNamedObjectPath
0x771D7A6E (ntdll) RtlGetAppContainerNamedObjectPath

========== END OF STACKTRACE ===========

A crash has been intercepted by the crash handler. For call stack and other details, see the latest crash report generated in:

  • C:/Users/PC/AppData/Local/Temp/DefaultCompany/zbasketball_st/Crashes

几个DHE问题(3)

环境

Unity 2020.3.33
il2cpp_plus 2020-DHE
hybridclr DHE
hybridclr_unity DHE
OS+Build Windows 10 64 bit
project dhe_demo(没开间接函数优化)

问题1

执行下面代码会崩溃:

[Serializable]
public class A
{
    public bool F1 = true;
}

[Serializable]
public class B : A
{
    public bool F2 = true;
    public bool F3;
    public List<int> F4;
}

class Case20
{
    public static void Run()
    {
        var obj = (A)JsonUtility.FromJson("{\"F1\":false}", typeof(B));
        UnityEngine.Debug.Log(obj.F1);
    }
}

void Start()
{

	// Run("函数未变化,运行AOT版本", RunNotChangedMethod);
	// Run("函数有变化,运行解释器版本", RunChangedMethod);

	Case20.Run();
}

崩溃信息:

Exception thrown at 0x00007FFF1BF9B094 (UnityPlayer.dll) in HybridDll.exe: 0xC0000005: Access violation reading location 0x0000000000000011.

崩溃调用栈:

UnityPlayer.dll!LinearCollectionField::GetArray(void)	Unknown
UnityPlayer.dll!TransferField_LinearCollection<class ConfigSettingsRead>(struct SerializationCommandArguments const &,struct RuntimeSerializationCommandInfo &)	Unknown
UnityPlayer.dll!ExecuteSerializationCommands<class ConfigSettingsRead>(struct dynamic_array<struct SerializationCommand,0> const &,class ConfigSettingsRead &,class GeneralMonoObject const &)	Unknown
UnityPlayer.dll!TransferScriptingObject<class JSONRead,0>(class JSONRead &,class ScriptingObjectPtr,class ScriptingClassPtr,struct SerializationCache::Data * &,class ManagedReferencesRegistry *)	Unknown
UnityPlayer.dll!TransferScriptingObject<class JSONRead>(class JSONRead &,class ScriptingObjectPtr,class ScriptingClassPtr,struct MonoScriptCache const *)	Unknown
UnityPlayer.dll!FromJsonInternal(class core::basic_string<char,class core::StringStorageDefault<char> > const &,class ScriptingObjectPtr,class ScriptingClassPtr,class ScriptingExceptionPtr *)	Unknown
UnityPlayer.dll!JsonUtility_CUSTOM_FromJsonInternal(class ScriptingBackendNativeStringPtrOpaque *,class ScriptingBackendNativeObjectPtrOpaque *,class ScriptingBackendNativeObjectPtrOpaque *)	Unknown
GameAssembly.dll!JsonUtility_FromJsonInternal_m7353836E98A52C702E713DBE5E9C431BD8EC830A(String_t * ___json0, Il2CppObject * ___objectToOverwrite1, Type_t * ___type2, const MethodInfo * method) Line 749	C++
GameAssembly.dll!JsonUtility_FromJson_m81FC2A7DCB9231E8E201EAD8E160F921B1D2E25C(String_t * ___json0, Type_t * ___type1, const MethodInfo * method) Line 854	C++
GameAssembly.dll!Case20_Run_m126C442FA7468F54630F022190BBE7E0219BBE7A(const MethodInfo * method) Line 1122	C++
GameAssembly.dll!HotUpdateMain_Start_m066DF6C3B58C241A7A7F8CA33791EFCCE22FAAC2(HotUpdateMain_t9691E9193AC822C20C46ED6B1C1F26EEB0EC8F21 * __this, const MethodInfo * method) Line 1185	C++
GameAssembly.dll!RuntimeInvoker_TrueVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5(void(*)() methodPointer, const MethodInfo * methodMetadata, void * obj, void * * args) Line 27843	C++
GameAssembly.dll!il2cpp::vm::Runtime::Invoke(const MethodInfo * method, void * obj, void * * params, Il2CppException * * exc) Line 559	C++
GameAssembly.dll!il2cpp_runtime_invoke(const MethodInfo * method, void * obj, void * * params, Il2CppException * * exc) Line 1118	C++
...

查了下,是字段布局和IL2CPP原本的不一致导致的。和IL2CPP的代码对比了下,发现原本System.Object的最小对齐是指针大小,HybridCLR直接用了1

问题2

执行下面代码会崩溃:

public abstract class A<T>
{
    public List<T> D = new List<T>();
}

public class B<T1, T2> : A<Action<T1, T2>>
{

}

public class C
{

}

public class HotUpdateMain : MonoBehaviour
{
    public B<C, C> B = new B<C, C>();

    void Start()
    {
        UnityEngine.Debug.Log(B.D.Count);
    }
}

崩溃信息:

Exception thrown: read access violation.method->klass->rgctx_data was nullptr.

崩溃调用栈:

GameAssembly.dll!A_1__ctor_mEED8058ABFA500A40294771CB8E97D19EE7AB818_gshared(A_1_t07D96EE2B9CE8B3CD0D4BD89B30F9AC917BB780B * __this, const MethodInfo * method) Line 10606	C++
GameAssembly.dll!B_2__ctor_m60BC8C51983FF411DB5E772CEBC95CD7AB257757_gshared(B_2_t2654A0DA705819C42DC5558AE9A2DD5159BB992D * __this, const MethodInfo * method) Line 36301	C++
GameAssembly.dll!B_2__ctor_mF25B031406C1FDBCB812BCD1EDC944C8771F76BB(B_2_t0B5CD9A23C3DA938F788BE1B5E0E6CACD5A75F16 * __this, const MethodInfo * method) Line 854	C++
GameAssembly.dll!HotUpdateMain__ctor_m5549897CFBEE17CCA2EBEFF1DE62E41891423004(HotUpdateMain_t9691E9193AC822C20C46ED6B1C1F26EEB0EC8F21 * __this, const MethodInfo * method) Line 1223	C++
GameAssembly.dll!RuntimeInvoker_TrueVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5(void(*)() methodPointer, const MethodInfo * methodMetadata, void * obj, void * * args) Line 28206	C++
GameAssembly.dll!il2cpp::vm::Runtime::Invoke(const MethodInfo * method, void * obj, void * * params, Il2CppException * * exc) Line 559	C++
GameAssembly.dll!il2cpp::vm::Runtime::ObjectInitException(Il2CppObject * object, Il2CppException * * exc) Line 600	C++
GameAssembly.dll!il2cpp_runtime_object_init_exception(Il2CppObject * obj, Il2CppException * * exc) Line 1133	C++
UnityPlayer.dll!scripting_unity_engine_object_new_and_invoke_default_constructor(class ScriptingClassPtr,class Object *,class ScriptingExceptionPtr *)	Unknown
UnityPlayer.dll!SerializableManagedRef::RebuildMonoInstance(class Object *,class ScriptingClassPtr,class ScriptingObjectPtr,class MonoScript *)	Unknown
...

查了下,发现TranslateGenericMethodToDHE的实现有问题:

const Il2CppGenericMethod* DifferentialHybridImage::TranslateGenericMethodToDHE(const Il2CppGenericMethod* genericMethod, ScopedMetadataPool* pool)
{
	const Il2CppImage* image = genericMethod->methodDefinition->klass->image;

	// ...

        // 应该使用 hybridclr::metadata::IsAOTImageDifferentialHbyridImage 判断?
	if (hybridclr::metadata::IsDifferentialHybridImage(image))
	{
		const Il2CppMethodDefinition* dhMethodDef = TranslateMethodDefinitionToDHE((Il2CppMethodDefinition*)dhMethod->methodMetadataHandle, pool);
		if ((Il2CppMetadataMethodDefinitionHandle)dhMethodDef != dhMethod->methodMetadataHandle)
		{
			dhMethod = il2cpp::vm::GlobalMetadata::GetMethodInfoFromMethodHandle((Il2CppMetadataMethodDefinitionHandle)dhMethodDef);
		}
	}

	// ...
}

问题3

执行下面代码会崩溃

struct A
{
    public int X;
}

class B<T> where T : new()
{
    public static T Func()
    {
        return new T();
    }
}

void Start()
{

	// Run("函数未变化,运行AOT版本", RunNotChangedMethod);
	// Run("函数有变化,运行解释器版本", RunChangedMethod);

	UnityEngine.Debug.Log(B<A>.Func());
}

崩溃信息:

Exception thrown at 0x0000000000000000 in HybridDll.exe: 0xC0000005: Access violation executing location 0x0000000000000000.

崩溃调用栈:

GameAssembly.dll!B_1_Func_mE421648D2CF012FC04629DAD82317A83DE874810_gshared(const MethodInfo * method) Line 36189	C++
GameAssembly.dll!B_1_Func_mE421648D2CF012FC04629DAD82317A83DE874810(const MethodInfo * method) Line 648	C++
GameAssembly.dll!HotUpdateMain_Start_m066DF6C3B58C241A7A7F8CA33791EFCCE22FAAC2(HotUpdateMain_t9691E9193AC822C20C46ED6B1C1F26EEB0EC8F21 * __this, const MethodInfo * method) Line 760	C++
GameAssembly.dll!RuntimeInvoker_TrueVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5(void(*)() methodPointer, const MethodInfo * methodMetadata, void * obj, void * * args) Line 27877	C++
GameAssembly.dll!il2cpp::vm::Runtime::Invoke(const MethodInfo * method, void * obj, void * * params, Il2CppException * * exc) Line 559	C++
GameAssembly.dll!il2cpp_runtime_invoke(const MethodInfo * method, void * obj, void * * params, Il2CppException * * exc) Line 1118	C++
UnityPlayer.dll!scripting_method_invoke(class ScriptingMethodPtr,class ScriptingObjectPtr,struct ScriptingArguments &,class ScriptingExceptionPtr *,bool)	Unknown
UnityPlayer.dll!ScriptingInvocation::Invoke(class ScriptingExceptionPtr *,bool)	Unknown
UnityPlayer.dll!MonoBehaviour::InvokeMethodOrCoroutineChecked(class ScriptingMethodPtr,class ScriptingObjectPtr,class ScriptingExceptionPtr *)	Unknown
...

看起来是因为Activator.CreateInstance是在非DHE Assembly的泛型方法,而A是DHE Assembly的类型,在获取泛型函数指针时,没有将A转换成AOT对应的类型,导致查找不到这个函数指针

问题4

值类型的静态构造函数在aotAdjustorThunk中没找到,就使用了InterpreterModule::NotSupportNative2Managed,导致执行时抛异常:ExecutionEngineException: NotSupportNative2Managed

复现代码:

struct A
{
    public static bool Switch = true;

    public int X;

    public static A One
    {
        get
        {
            int x = Switch ? 1 : 0;
            return new A { X = x };
        }
    }
}

public class HotUpdateMain : MonoBehaviour
{
    private A a = A.One;

    void Start()
    {
        UnityEngine.Debug.Log(A.One.X);
    }
}

期望结果:输出1
实际结果:抛异常,并输出0

DHE等价性计算的性能

在项目中测试了最新的hybridclr_unity,可以正常生成Assembly-CSharp.dhao.bytes了,但是执行一次耗时约7分钟(机器配置是 Windows 10 64 bit + i7-12700),感觉有点久。
我加了一些性能统计,生成了一个可以用chrome://tracing/查看的文件,请看下是否可以做一些优化,比如

  • 缓存CompareFieldOrParamOrVariableType的结果
  • 缓存TryGetDHEMethodDef的结果

HybridCLRTEP.zip

x64模拟器闪退

请问官网上记录的商用项目在x64模拟器上闪退是因为bug还是不支持x64模拟器?不支持的话是什么原因,后续有可能解决吗?

ExecutionEngineException: System.Collections.Generic.Stack`1::.ctor method body is null. not support external method currently.

错误提示为 external相关,但是代码中未涉及,稳定复现
hybridclr_trial 工程中,加入部分代码如下:

Unity Editor版本: 2021.3.11f1(M1版本)
image
操作系统: MacOS Ventura 13.0
BuildTarget:IOS
hybridclr_trial 的版本号 0.9

public class HotUpdateMain : MonoBehaviour
{

public string text;

// Start is called before the first frame update
void Start()
{
    Debug.Log("这个热更新脚本挂载在prefab上,打包2222222成ab。通过从ab中实例化prefab成功还原");
    Debug.LogFormat("hello, {0}.", text);

    gameObject.AddComponent<CreateByCode>();

  
    
    Debug.Log("=======看到此条日志代表你成功运行2222222了示例项目的热更新代码=======");
    UpdateContext test = new UpdateContext();
    Debug.Log("=======看到此条日志代表你成功运行3333333了示例项目的热更新代码=======");
}

}

public class UpdateContext
{
public struct ClipInfo
{
public Rect rect;
public Vector4 clipBox;
public bool soft;
public Vector4 softness; //left-top-right-bottom
public uint clipId;
public int rectMaskDepth;
public int referenceValue;
public bool reversed;
}

public UpdateContext()
{
    _clipStack = new Stack<ClipInfo>();
}

Stack<ClipInfo> _clipStack;
public static UpdateContext current;

}

运行期Log:
LoadMetadataForAOTAssembly:System.Core.dll. mode:SuperSet ret:OK
LoadDll:LoadMetadataForAOTAssemblies()
LoadDll:StartGame()
d__7:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

这个热更新脚本挂载在prefab上,打包2222222成ab。通过从ab中实例化prefab成功还原
UnityEngine.StackTraceUtility:ExtractStackTrace()

hello, HybridCLR.
UnityEngine.StackTraceUtility:ExtractStackTrace()

=======看到此条日志代表你成功运行2222222了示例项目的热更新代码=======
UnityEngine.StackTraceUtility:ExtractStackTrace()

ExecutionEngineException: System.Collections.Generic.Stack`1::.ctor method body is null. not support external method currently.
at UpdateContext..ctor () [0x00000] in <00000000000000000000000000000000>:0
at HotUpdateMain.Start () [0x00000] in <00000000000000000000000000000000>:0

这个脚本是通过代码AddComponent直接创建的3333333
UnityEngine.StackTraceUtility:ExtractStackTrace()

新老包同时在线上使用的兼容问题

0FLT9SX8V2QQMNSV$N}QWLR
由于默认会首先返回AOT dll。假如有A.dll在线上的所有较老包是AOT dll,在线上的所有较新包是Hot dll,那么Hot dll变动比较大的时候,解释执行其实是会有问题的。解释执行的问题诱因如下
ZM)WB J(JXZU(%9$DQDTTAL
E@TPQ6KLR{D@XUP)X `W017
$(BCXGY@~TBJM YWGZE_D9I
这里其实是是会获取到的老的AOT相关的数据,因为是通过assembly name去获取相关的信息的,产生不可预知的错误。
且此时的其他部分的反射接口Assembly.Load("A.dll").GetType().GetMethod()这种,在所有较老包上也是会调用到老的AOT dll的相关方法,无法调用到新的Hot dll的相关方法。

关于Assembly.GetExecutingAssembly

环境

Unity 2020.3.33
il2cpp_plus 2020-1.0
hybridclr 1.0
hybridclr_unity 1.0
OS+Build Windows 10 64 bit
project hybridclr_trial

问题

Assembly.GetExecutingAssembly()返回了错误的assembly,看文档说是IL2CPP的bug。但是我测试了在AOT中调用是正常的:

string TestInMain()
{
	return Assembly.GetExecutingAssembly().FullName;
}

生成的C++代码:

// System.String LoadDll::TestInMain()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR String_t* LoadDll_TestInMain_m453A6AE1AE65CDB8E6502B9C4C6E71559A18B7D9 (LoadDll_tF4302664700CA4FCBC0471B8C95631AE6442BC68 * __this, const RuntimeMethod* method)
{
	static bool s_Il2CppMethodInitialized;
	if (!s_Il2CppMethodInitialized)
	{
		il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&LoadDll_TestInMain_m453A6AE1AE65CDB8E6502B9C4C6E71559A18B7D9_RuntimeMethod_var);
		s_Il2CppMethodInitialized = true;
	}
	{
		// return Assembly.GetExecutingAssembly().FullName;
		Assembly_t * L_0;
		L_0 = il2cpp_codegen_get_executing_assembly(LoadDll_TestInMain_m453A6AE1AE65CDB8E6502B9C4C6E71559A18B7D9_RuntimeMethod_var);
		NullCheck(L_0);
		String_t* L_1;
		L_1 = VirtFuncInvoker0< String_t* >::Invoke(12 /* System.String System.Reflection.Assembly::get_FullName() */, L_0);
		return L_1;
	}
}

看起来IL2CPP做了特殊处理,并不会去调用Assembly.GetExecutingAssembly()生成的C++函数Assembly_GetExecutingAssembly_m990AB6145F5E80CC3CC8912043DC18497C2369EB

// System.Reflection.Assembly System.Reflection.Assembly::GetExecutingAssembly()
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Assembly_t * Assembly_GetExecutingAssembly_m990AB6145F5E80CC3CC8912043DC18497C2369EB (const RuntimeMethod* method)
{
	static bool s_Il2CppMethodInitialized;
	if (!s_Il2CppMethodInitialized)
	{
		il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Assembly_GetExecutingAssembly_m990AB6145F5E80CC3CC8912043DC18497C2369EB_RuntimeMethod_var);
		s_Il2CppMethodInitialized = true;
	}
	return il2cpp_codegen_get_executing_assembly(Assembly_GetExecutingAssembly_m990AB6145F5E80CC3CC8912043DC18497C2369EB_RuntimeMethod_var);
}

HybridCLR的解释版本执行之所以有问题,就是因为调用了这个函数。

是否考虑做下特殊处理解决这个问题?比如新增一个InstinctInstrument,专门用于处理Assembly.GetExecutingAssembly()

使用SuperSet模式加载未裁剪的Newtonsoft.Json.dll,不能正确补充元数据

测试环境:

  • Unity 2020.3.30
  • Windows 10
  • Win64

问题

使用SuperSet模式加载未裁剪的Newtonsoft.Json.dll,后续执行到相关代码时,会有下面的报错:

MissingMethodException: MethodNotFound System.Reflection.Missing::GetTypeFromHandle

当这个dll是拷贝自PackageCache/[email protected]时,无论是来自Runtime内,还是来自Runtime/AOT内,都会导致同样的错误。

当这个dll是拷贝自AssembliesPostIl2CppStrip时,就没问题。

复现工程

一运行,就会有报错:
hybridclr_trial.zip

Image::FindImplMethod 没有正确处理一些情况

比如下面的代码:

interface IX
{
    string ToString();
}

struct A
{
    public new string ToString()
    {
        return "A.ToString";
    }
}

struct B : IX
{
    public new string ToString()
    {
        return "B.ToString";
    }
}

interface IY
{
    string Foo();
}

struct C : IY
{
    public int X, Y;

    string IY.Foo()
    {
        return "IY.Foo";
    }

    public string Foo()
    {
        return "C.Foo";
    }
}

namespace XXX
{
    public class YYY
    {
        public interface IZ
        {
            string Bar();
        }
    }
}

struct D : XXX.YYY.IZ
{
    public int X, Y;

    string XXX.YYY.IZ.Bar()
    {
        return "IZ.Bar";
    }

    public string Bar()
    {
        return "D.Bar";
    }
}

struct E : IComparable<E>
{
    int IComparable<E>.CompareTo(E other)
    {
        Debug.Log("IComparable<E>.CompareTo");
        return 0;
    }

    public int CompareTo(E other)
    {
        Debug.Log("E.CompareTo");
        return 0;
    }
}

public class PrintHello : MonoBehaviour
{

    public string text;

    void Start()
    {
        Test();
    }

    void Test1<T>(T obj)
    {
        Debug.Log(obj.ToString());
    }

    void Test2<T>(T obj) where T : IY
    {
        Debug.Log(obj.Foo());
    }

    void Test3<T>(T obj) where T : XXX.YYY.IZ
    {
        Debug.Log(obj.Bar());
    }

    void Test4<T>(T obj) where T : IComparable<T>
    {
        obj.CompareTo(obj);
    }

    void Test()
    {
        Test1(new A());
        Test1(new B());
        Test2(new C());
        Test3(new D());
        Test4(new E());
    }
}

现在的结果:

A.ToString
B.ToString
C.Foo
D.Bar
E.CompareTo

正确的结果:

A
B
IY.Foo
IZ.Bar
IComparable<E>.CompareTo

请问,Generate All、补充元数据的DLL更新的执行时机的最佳实践?

请问,Generate All、更新补充元数据的DLL到我们自己的资源管理系统内,这两项操作的执行时机有最佳实践吗?

我看文档里提到了只有热更程序集代码变动的时候,只Compile热更程序集就好,那是不是意味着:

有AOT代码修改时,就需要执行Generate All、更新补充元数据的DLL到我们自己的资源管理系统内,这两项操作

unity2021.3.20f1c1下打包时错误,求解决方案

抱歉,其实是在ET7版本里打包时发现的错误,但是猫大也没有遇到过这种情况,来这个咨询下大佬,打搅了!

ET版本: 7.2

Unity版本: 2021.3.20f1c1 apple silicon

Net版本: 6.0.407

在macos m1环境下,按照文档 打包过程,进行到第6步,第二次打包时,不选择build exe时,不报错,啥也打不出来。选择build exe时,报如图错误!大佬有碰到过吗?如何解决的,谢谢。

image

image

Android上运行Await报错

Unity Editor:2021.3.9
系统:Android10 - 12
BuildTarget : ARM64
hybridclr : 0.6.1
il2cpp_plus仓库版本:image
截图:
N2X8565 RN_U24U1MA7)C
Z~$~P}RMNKVHR1HA3{D7NCB

在多份线上报错日志中报错堆栈都是Hotfix代码await调用AOT代码发生的报错.

小白提问unity packages 导入一个新的 package 如何热更新

unity packages 导入一个新的package 如何热更新,热更代码使用都会报

TypeLoadException: Could not load type ‘Cysharp.Threading.Tasks.UniTask’ from assembly ‘UniTask’

这样,岂不是导入一个第三方package都无法热更新了?还是我哪里使用问题

HybridCLR 与 Netcode同时使用,rpc方法放到热更dll里面,调用rpc方法时报错

同时使用HybridRLC和Netcode(资源打包使用Addressable),RPC函数写在热更DLL里,实机运行调用RPC方法时报错ExecutionEngineException: NotSupportNative2Managed

ExecutionEngineException: NotSupportNative2Managed
at Unity.Netcode.RpcMessageHelpers.Handle (Unity.Netcode.NetworkContext& context, Unity.Netcode.RpcMetadata& metadata, Unity.Netcode.FastBufferReader& payload, Unity.Netcode.__RpcParams& rpcParams) [0x00063] in F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Messaging\Messages\RpcMessages.cs:77
at Unity.Netcode.ClientRpcMessage.Handle (Unity.Netcode.NetworkContext& context) [0x0003a] in F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Messaging\Messages\RpcMessages.cs:154
at Unity.Netcode.MessagingSystem.ReceiveMessage[T] (Unity.Netcode.FastBufferReader reader, Unity.Netcode.NetworkContext& context, Unity.Netcode.MessagingSystem system) [0x00055] in F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Messaging\MessagingSystem.cs:457
at Unity.Netcode.MessagingSystem.HandleMessage (Unity.Netcode.MessageHeader& header, Unity.Netcode.FastBufferReader reader, System.UInt64 senderId, System.Single timestamp, System.Int32 serializedHeaderSize) [0x00140] in F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Messaging\MessagingSystem.cs:387
at Unity.Netcode.MessagingSystem.ProcessIncomingMessageQueue () [0x00032] in F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Messaging\MessagingSystem.cs:407
at Unity.Netcode.NetworkManager.OnNetworkEarlyUpdate () [0x00066] in F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Core\NetworkManager.cs:1541
at Unity.Netcode.NetworkManager.NetworkUpdate (Unity.Netcode.NetworkUpdateStage updateStage) [0x00018] in F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Core\NetworkManager.cs:1473
at Unity.Netcode.NetworkUpdateLoop.RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage updateStage) [0x0002f] in F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Core\NetworkUpdateLoop.cs:185
at Unity.Netcode.NetworkUpdateLoop+NetworkEarlyUpdate+<>c.b__0_0 () [0x00001] in F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Core\NetworkUpdateLoop.cs:208
Rethrow as Exception: Unhandled RPC exception!

UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
Unity.Netcode.RpcMessageHelpers:Handle(NetworkContext&, RpcMetadata&, FastBufferReader&, __RpcParams&) (at F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Messaging\Messages\RpcMessages.cs:81)
Unity.Netcode.ClientRpcMessage:Handle(NetworkContext&) (at F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Messaging\Messages\RpcMessages.cs:154)
Unity.Netcode.MessagingSystem:ReceiveMessage(FastBufferReader, NetworkContext&, MessagingSystem) (at F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Messaging\MessagingSystem.cs:457)
Unity.Netcode.MessagingSystem:HandleMessage(MessageHeader&, FastBufferReader, UInt64, Single, Int32) (at F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Messaging\MessagingSystem.cs:387)
Unity.Netcode.MessagingSystem:ProcessIncomingMessageQueue() (at F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Messaging\MessagingSystem.cs:407)
Unity.Netcode.NetworkManager:OnNetworkEarlyUpdate() (at F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Core\NetworkManager.cs:1541)
Unity.Netcode.NetworkManager:NetworkUpdate(NetworkUpdateStage) (at F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Core\NetworkManager.cs:1473)
Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage(NetworkUpdateStage) (at F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Core\NetworkUpdateLoop.cs:185)
Unity.Netcode.<>c:b__0_0() (at F:\HybridCLR_Netcode\Library\PackageCache\[email protected]\Runtime\Core\NetworkUpdateLoop.cs:208)

委托调用失败

下面的代码,在 Unity 2020.3.30 + Win64 的情况下,执行失败:

// 在 hybrid_trial 工程中测试
public class CreateByCode : MonoBehaviour
{
    public event Action<bool, int, int> OnTest;

    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("这个脚本是通过代码AddComponent直接创建的");

        OnTest += TestHandler;
        OnTest += TestHandler;

        FireTest(true, 0, 1);
    }

    private void TestHandler(bool arg1, int arg2, int arg3)
    {
        Debug.Log("Test");
    }

    public void FireTest(bool allChanged, int faction, int index)
    {
        if (OnTest != null)
            OnTest(allChanged, faction, index);
    }
}

期望输出:

Test
Test

实际输出:

ExecutionEngineException: NotSupportNative2Managed

如果 TestHandler 只注册一次,就没问题。

CompareTypeLayout没有正确处理值类型

环境

Unity: 2020.3.42
il2cpp_plus: 2020-DHE
hybridclr: DHE
hybridclr_unity: DHE
OS+Build: Windows 10 64 bit

问题

对于值类型,td1.IsClasstd1.IsValueClass同时为true,但是IsClass的分支在前面,导致处理值类型的分支不会执行到

在dhe_demo中使用下面的代码可以复现问题:

public class Case8
{
#if DHE_HOT_UPDATE
    [StructLayout(LayoutKind.Auto, Size = 32)]
#endif
    public struct Color
    {
        public float R, G, B, A;
    }

    public unsafe static void Run()
    {
        Debug.Log(sizeof(Color));
    }
}

void Start()
{

	// Run("函数未变化,运行AOT版本", RunNotChangedMethod);
	// Run("函数有变化,运行解释器版本", RunChangedMethod);

	Case8.Run();
}

期望输出:32
实际输出:16

几个DHE问题

环境

Unity 2020.3.42
il2cpp_plus 2020-DHE
hybridclr DHE
hybridclr_unity DHE
OS+Build Windows 10 64 bit
project dhe_demo (没开间接函数优化)

问题1

DifferentialHybridImageFindMatchMethod中调用IsDHEMethodSigEqual时,参数顺序颠倒了,导致本来可以用AOT版本执行的方法,用解释器执行了

public class A
{
}

public class B : A
{
}

public class Case12
{
    public static void Run()
    {
#if true

#if DHE_HOT_UPDATE
        A obj = new B();
#else
        A obj = new A();
#endif

#else
        A obj = new B();
#endif

        Run1(obj);
    }

    private static void Run1(A obj)
    {
        var arr = new int[1000000];

        for (int j = 0; j < 5; ++j)
        {
            var sw = new Stopwatch();
            sw.Start();

            for (int i = 0; i < arr.Length; i++)
            {
                arr[i] = arr[i] ^ i;
                arr[i] += i;
            }

            sw.Stop();
            long costTime = sw.ElapsedMilliseconds;
            UnityEngine.Debug.Log($"{obj.GetType()} round:[{j}] cost time:{costTime} ms");
        }
    }
}

void Start()
{
	Case12.Run();
}

期望结果:Run1方法执行AOT版本

实际结果:Run1方法执行解释器版本

问题2

没有正确处理类型去掉sealed的情况(需要修复问题1之后,才能复现)

public class A
{
}

#if DHE_HOT_UPDATE
public class B : A
{
}

public class C : B
{
}
#else
public sealed class B : A
{
}
#endif

public class Case13
{
    public static void Run()
    {
#if DHE_HOT_UPDATE
        B obj = new C();
#else
        B obj = new B();
#endif
        Run1(obj);
    }

    public static void Run1(A obj)
    {
        var b = (B)obj;
	    UnityEngine.Debug.Log(b.GetType());
	}
}

void Start()
{
	Case13.Run();
}

期望结果:输出C

实际结果:触发断言(B必须是sealed类型)

问题3

没有正确处理新增静态构造函数的情况

public class A
{
    private static int X;

#if DHE_HOT_UPDATE
    static A()
    {
        X = 2;
    }
#endif

    public static void Func()
    {
        UnityEngine.Debug.Log(X);
    }
}

public class Case14
{
    public static void Run()
    {
        A.Func();
    }
}

void Start()
{
	Case14.Run();
}

期望结果:输出2

实际结果:输出0

问题4

DifferentialHybridImageFindMatchFieldIndex中没有正确判断名字是否相同

class A
{
    private static readonly int[] mNumbers1 = { 1, 2, 3 };
    private static readonly int[] mNumbers2 = { -1, -2, -3 };

    public static void Func()
    {
        for (int i = 0; i < mNumbers1.Length; ++i)
            UnityEngine.Debug.Log(mNumbers1[i]);

        for (int i = 0; i < mNumbers2.Length; ++i)
            UnityEngine.Debug.Log(mNumbers2[i]);
    }
}

class Case16
{
    public static void Run()
    {
        A.Func();
    }
}

void Start()
{
	Case16.Run();
}

期望输出:

1
2
3
-1
-2
-3

实际输出:

-1
-2
-3
-1
-2
-3

调用key为枚举类型的Dictionary的TryGetValue,有内存分配的问题

测试环境

  • Unity 2020.3.30
  • Windows 10
  • Win64 的包

问题

调用key为枚举类型的Dictionary的TryGetValue,有内存分配。查了下,内存分配是在其中调用的FindEntry里:

private int FindEntry(TKey key) {
	if( key == null) {
		ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
	}

	// ...
}

这个代码被编译成了下面的IL:

IL_0000: ldarg.1
IL_0001: box !TKey
IL_0006: brtrue.s IL_0013

IL_0008: ldstr "key"
IL_000d: newobj instance void System.ArgumentNullException::.ctor(string)
IL_0012: throw

其中的box指令导致了内存分配。

IL2CPP没这个问题,因为它把整个分支都优化掉了。

打包时报System.UnauthorizedAccessException错误

在使用jenkins+SVN工具打包时,会报Exception: System.UnauthorizedAccessException错误。应该是svn工具会给每个文件夹下增加.svn文件,但是打包时会试图删除整个文件夹。这时会遇到.svn文件夹下的文件无法删除的错误。我不确定这是不是bybridclr的错误,但是我觉得有必要关注下这个问题。

Exception: System.UnauthorizedAccessException: Access to the path 'C:\ProgramData\Jenkins\.jenkins\workspace\build_1.2.4_windows_debug\Library\Il2cppBuildCache\Windows\x64\Native\Data\etc\.svn\entries' is denied.
   at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
   at NiceIO.NPath.CopyWithDeterminedDestination(NPath absoluteDestination, Func`2 fileFilter)
   at NiceIO.NPath.CopyWithDeterminedDestination(NPath absoluteDestination, Func`2 fileFilter)
   at NiceIO.NPath.CopyWithDeterminedDestination(NPath absoluteDestination, Func`2 fileFilter)
   at NiceIO.NPath.CopyWithDeterminedDestination(NPath absoluteDestination, Func`2 fileFilter)
   at Unity.IL2CPP.Building.BuildDescriptions.IL2CPPOutputBuildDescription.FinalizeBuild(CppToolChain toolChain)
   at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
   at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection`1 matchedAssemblyMethodSourceFiles)
   at il2cpp.Program.DoRun(String[] args, RuntimePlatform platform, BuildingOptions buildingOptions, Boolean throwExceptions)
  at UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) [0x00154] in <ae2b3fa0806947cd9e0033e4ac1637da>:0 
  at UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) [0x00060] in <ae2b3fa0806947cd9e0033e4ac1637da>:0 
  at UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo) [0x00116] in <ae2b3fa0806947cd9e0033e4ac1637da>:0 
  at UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data) [0x003c1] in <ae2b3fa0806947cd9e0033e4ac1637da>:0 
  at UnityEditorInternal.IL2CPPBuilder.Run () [0x000f4] in <ae2b3fa0806947cd9e0033e4ac1637da>:0 
  at UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) [0x0001c] in <ae2b3fa0806947cd9e0033e4ac1637da>:0 
  at DesktopStandalonePostProcessor.RunIL2CPP (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditorInternal.IIl2CppPlatformProvider il2cppPlatformProvider, System.Collections.Generic.List`1[T] cppPlugins) [0x0001c] in <ae2b3fa0806947cd9e0033e4ac1637da>:0 
  at DesktopStandalonePostProcessor.SetupStagingArea (UnityEditor.Modules.BuildPostProcessArgs args, System.Collections.Generic.HashSet`1[T] filesToNotOverwrite) [0x000a4] in <ae2b3fa0806947cd9e0033e4ac1637da>:0 
  at DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) [0x00015] in <ae2b3fa0806947cd9e0033e4ac1637da>:0 
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
  at DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) [0x00070] in <ae2b3fa0806947cd9e0033e4ac1637da>:0 
  at UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) [0x00001] in <ae2b3fa0806947cd9e0033e4ac1637da>:0 
  at UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) [0x000dc] in <ae2b3fa0806947cd9e0033e4ac1637da>:0 
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, String[], Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, String[])
UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, String[])
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions)
UnityEditor.BuildPipeline:BuildPlayer(EditorBuildSettingsScene[], String, BuildTarget, BuildOptions)

hotfix dll 中使用UniTask 在WebGL上运行内存出错

1,hybridclr_trial-main 中导入UniTask https://github.com/Cysharp/UniTask
2,HotUpdate目录添加hotfix 测试代码
public class HotUpdateMain1
{
public static async UniTaskVoid UTaskHotFIxTest()
{
Debug.Log("UTaskHotFIxTest OK");
await UniTask.CompletedTask;
}

public static void  Start()
{
    UTaskHotFIxTest().Forget();
}

}
3,修改LoadDll.cs
3.1添加 AOT dll
public static List AOTMetaAssemblyNames { get; } = new List()
{
"mscorlib.dll",
"System.dll",
"System.Core.dll",
"UniTask.dll",
};
3.2 修改StartGame 添加HotUpdateMain1测试调用
void StartGame()
{
LoadMetadataForAOTAssemblies();

    System.Reflection.Assembly hotFixDll = null;

#if !UNITY_EDITOR
hotFixDll = System.Reflection.Assembly.Load(GetAssetData("Assembly-CSharp.dll"));
#else
hotFixDll = AppDomain.CurrentDomain.GetAssemblies().First(assembly => assembly.GetName().Name == "Assembly-CSharp");
#endif

    AssetBundle prefabAb = AssetBundle.LoadFromMemory(GetAssetData("prefabs"));
    GameObject testPrefab = Instantiate(prefabAb.LoadAsset<GameObject>("HotUpdatePrefab.prefab"));

    System.Reflection.MethodInfo methodInfo = hotFixDll.GetType("HotUpdateMain1").GetMethod("Start");
    object[] param = new object[methodInfo.GetParameters().Length];
    methodInfo.Invoke(null, param);
}

4,webgl报错信息
"An error occurred running the Unity content on this page. See your browser javaScript console for more info. the error was:
RuntimeError:null function or function signature mismatch at .."

pc android 正常运行,unity 版本 2021.3.13 hybridclr 1.0 il2cpp_plus 2021.3.1

报错:TranslateIl2CppTypeFromAOTToDHE not support generic var

环境

Unity: 2020.3.42f1
il2cpp_plus: 2020-DHE
hybridclr: DHE
hybridclr_unity: DHE

问题

在dhe_demo执行下面代码,能够复现该问题:

public class Case2
{
    public class A<T>
    {
        public virtual string Run1()
        {
            return "A1: " + typeof(T);
        }

        public virtual string Run2()
        {
            return "A2: " + typeof(T);
        }
    }

    public class B<T> : A<T>
    {
        public override string Run1()
        {
            return "B1: " + typeof(T);
        }

        public override string Run2()
        {
#if DHE_HOT_UPDATE
            return "B22: " + typeof(T);
#else
            return "B2: " + typeof(T);
#endif
        }

        public virtual string Run3()
        {
            return "B3: " + typeof(T);
        }
    }

    public static void Run()
    {
        A<int> a1 = new A<int>();
        Assert.IsTrue(a1.Run1() == "A1: System.Int32");
        Assert.IsTrue(a1.Run2() == "A2: System.Int32");
        Debug.Log(a1.Run1());
        Debug.Log(a1.Run2());

        A<string> a2 = new A<string>();
        Assert.IsTrue(a2.Run1() == "A1: System.String");
        Assert.IsTrue(a2.Run2() == "A2: System.String");
        Debug.Log(a2.Run1());
        Debug.Log(a2.Run2());

        B<double> b1 = new B<double>();
        Assert.IsTrue(b1.Run1() == "B1: System.Double");
        Assert.IsTrue(b1.Run2() == "B22: System.Double");
        Assert.IsTrue(b1.Run3() == "B3: System.Double");
        Debug.Log(b1.Run1());
        Debug.Log(b1.Run2());
        Debug.Log(b1.Run3());

        B<object> b2 = new B<object>();
        Assert.IsTrue(b2.Run1() == "B1: System.Object");
        Assert.IsTrue(b2.Run2() == "B22: System.Object");
        Assert.IsTrue(b2.Run3() == "B3: System.Object");
        Debug.Log(b2.Run1());
        Debug.Log(b2.Run2());
        Debug.Log(b2.Run3());
    }
}

public class HotUpdateMain : MonoBehaviour
{

    // Start is called before the first frame update
    void Start()
    {

        // Run("函数未变化,运行AOT版本", RunNotChangedMethod);
        // Run("函数有变化,运行解释器版本", RunChangedMethod);

        Case2.Run();
    }

    // ...	
}

DHE计算等价性问题

环境

Unity 2020.3.33
il2cpp_plus 2020-DHE
hybridclr DHE
hybridclr_unity DHE
OS+Build Windows 10 64 bit
project dhe_demo(没开间接函数优化)

问题

下面代码可复现问题(B.Func1被标记为变化,但Case23.RunHotUpdateMain .Start没有被标记为变化):

public interface IA
{
    void Func1();
}

public class B : IA
{
    public void Func1()
    {
#if DHE_HOT_UPDATE
        UnityEngine.Debug.Log("1");
#else
        UnityEngine.Debug.Log("2");
#endif
    }
}

public class Case23
{
    public static void Run()
    {
        var b = new B();
        b.Func1();
    }
}

public class HotUpdateMain : MonoBehaviour
{
    void Start()
    {
        Case23.Run();
    }
}

期望输出:1
实际输出:2

复现工程:dhe_demo.zip(如果单独使用上面代码复现不了问题,可以使用该工程)

Async/Await/Tasks NotSupportNative2Managed

When I use async/await code in C# I get:

static async Task<AssetBundle> GetStreamingAssetBundle(string bundleName) {...}

  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].AwaitUnsafeOnCompleted[TAwaiter,TStateMachine] (TAwaiter& awaiter, TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 
  at AppLoader.GetStreamingAssetBundle (System.String bundleName) [0x00000] in <00000000000000000000000000000000>:0 ```

I have tried following: https://focus-creative-games.github.io/hybridclr/method_bridge/#arm64-%E7%9A%84%E5%85%B1%E4%BA%AB%E8%A7%84%E5%88%99

When I check the generated file, it shows nothing about the async/await tasks.

关于unity2021.3.14f版本之前的il2cpp构建失败bug

相关报错是

Building Library\Bee\artifacts\WebGL\il2cpp\master_WebGL_wasm\v0f6_eric2.lump.o failed with output: In file included from Library/Bee/artifacts/WebGL/il2cpp/master_WebGL_wasm/33i3_Generic2.lump.cpp:7: D:\Software\Unity\Unity2021.3.10f1\Unity 2021.3.10f1\Editor\Data\il2cpp\libil2cpp\os\Generic\Process.cpp:11:22: error: out-of-line definition of 'Times' does not match any declaration in 'il2cpp::os::Process' int64_t Process::Times(ProcessHandle* handle, int32_t type) ^~~~~ D:\Software\Unity\Unity2021.3.10f1\Unity 2021.3.10f1\Editor\Data\il2cpp\libil2cpp\os\Generic\Process.cpp:17:22: error: out-of-line definition of 'StartTime' does not match any declaration in 'il2cpp::os::Process' int64_t Process::StartTime(ProcessHandle* handle) ^~~~~~~~~ D:\Software\Unity\Unity2021.3.10f1\Unity 2021.3.10f1\Editor\Data\il2cpp\libil2cpp\os\Generic\Process.cpp:23:22: error: out-of-line definition of 'GetProcessData' does not match any declaration in 'il2cpp::os::Process' int64_t Process::GetProcessData(int32_t pid, int32_t data_type, int32_t* error)

发现在更新3.14f版本是Process.h中这些函数被移除了
static int64_t Times(ProcessHandle* handle, int32_t type); static int64_t StartTime(ProcessHandle* handle); static int64_t GetProcessData(int32_t pid, int32_t data_type, int32_t* error);

因为我们目前在用unity2021.3.10f1进行开发,所以感觉这里在install时 再区分下unity2021.3.14f以下版本和以上的版本是不是比较好

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.