當使用我的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,但沒有得到任何有用的回覆。