当使用我的HoloLens时,当我在Unity脚本中抛出异常时,Visual Studio中的调试输出显示没有行号的堆栈跟踪。从Visual Studio运行Unity HoloLens程序时,抛出异常时,如何获取堆栈跟踪中的行号?
我该如何获得行号以及堆栈跟踪?我会很好的将它记录在调试输出以外的其他地方。
下面是在Visual Studio中常见的输出结果:
Exception thrown: 'System.NullReferenceException' in Assembly-CSharp.dll
NullReferenceException: Object reference not set to an instance of an object.
at NewBehaviourScript.Update()
at NewBehaviourScript.$Invoke6Update(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
(Filename: <Unknown> Line: 0)
以及相应的统一的脚本(我做了一个立方体,并附NewBehaviourScript
分量):
public class NewBehaviourScript : MonoBehaviour {
// Update is called once per frame
void Update()
{
object a = null;
a.GetType();
}
}
我试图从发布修改构建调试不会给出行号。
我试着用搜索引擎,它看起来像它没有显示的行数为他人,以及:http://answers.unity3d.com/questions/1315985/null-reference-in-line-0.html
我试着问上Microsoft's forums,但没有得到任何有用的回复。