Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

How do I get the line numbers in the stack trace when an exception is thrown?

Currently when an exception is thrown from within my Unity script while using my HoloLens the Debug Output shows the stack trace without the line numbers. Changing the build from Release to Debug doesn't give the line numbers.

How do I get the line numbers along with the stack trace? I'd be fine with it being logged somewhere else other than the Debug Output.

I tried looking around, and it looks like it's not showing the line numbers for others, as well: http://answers.unity3d.com/questions/1315985/null-reference-in-line-0.html

Thanks!

Tagged:

Answers

  • Options

    I think part of it can be due to where the exception is coming from. What exception are you hitting?

    Taqtile

  • Options

    Typically if it is in your code you can double click on the exception and it will open visual studio to the line in question.

    Taqtile

  • Options

    @mark_grossnickle said:
    Typically if it is in your code you can double click on the exception and it will open visual studio to the line in question.

    Double-clicking on the message in the Debug Output didn't open it. Here was the exception text:

    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)
    

    I made a Cube and attached a NewBehaviourScript component. Here is the code:

    public class NewBehaviourScript : MonoBehaviour {           
        // Update is called once per frame
        void Update ()
        {
            object a = null;
            a.GetType();    
        }
    }
    
  • Options

    Oh wait, are you running in visual studio or Unity? I was assuming unity.

    I think this sounds helpful for visual studio:
    https://forum.unity3d.com/threads/exception-with-filename-unknown-and-no-line-number.449449/

    Taqtile

  • Options

    Oh wait, are you running in visual studio or Unity? I was assuming unity.

    Visual Studio is where I'm running. I export from Unity using Build Settings and open the generate sln in Visual Studio.

    The question on that site sounds like "How do I get line numbers from a dll compiled by Visual Studio that I've imported into Unity when running in Unity?" The pdb2mdb.exe tool converts .pdb files to a format understood by Unity's scripting engine. I don't think that will help me running from Visual Studio.

Sign In or Register to comment.