focus-creative-games / il2cpp_plus

改造过的支持HybridCLR的il2cpp版本
https://code-philosophy.com/
MIT License
266 stars 91 forks source link

Debug.Log相关接口输出的调用栈不完整 #4

Closed AlanLiu90 closed 2 years ago

AlanLiu90 commented 2 years ago

用Unity 2020.3.33+Win64,在最新的hybridclr_trial工程中,修改 CreateByCode.cs 可复现:

public class CreateByCode : MonoBehaviour
{
    private void Awake()
    {
        A();
    }

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

        A();
    }

    // Update is called once per frame
    void Update()
    {

    }

    private void A()
    {
        B();
    }

    private void B()
    {
        Debug.LogError("Test");
    }
}

编辑器内的输出:

Test
UnityEngine.Debug:LogError (object)
CreateByCode:B () (at Assets/HotUpdate/CreateByCode.cs:33)
CreateByCode:A () (at Assets/HotUpdate/CreateByCode.cs:28)
CreateByCode:Start () (at Assets/HotUpdate/CreateByCode.cs:17)

Win64打包版本的输出:

Test

UnityEngine.Debug.LogError (Object)
pirunxi commented 2 years ago

这个问题已知,因为目前在抛异常的时候会计算所有栈,但普通的StackTrace时未将热更新栈计算在内。这个改起来有点麻烦,我们先记录下来,后面再解决。