Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

StackTrace doesnt have line numbers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    StackTrace doesnt have line numbers

    It's very pitty, that expections in NT doesnt have Line numbers (i mean StackTrace),
    even setting it true, doesnt give you the line number.

    on internet i found that something .pdb files should be there, in order to get line numbers.

    please NT team, give us line numbers in StackTrace, to see where exatcly expection was caught.

    Code:
    try{
       new throw Exception();
    }
    catch (Exception e){
      var trace = new System.Diagnostics.StackTrace(e, true);
       Print( trace.GetFrame( 0 ).GetFileLineNumber() ); 
       // instead of 0, there might need to be (trace.FrameCount-1) 
    }
    so, this doesnt give line number..

    #2
    Hello TazoTodua,

    Thanks for opening the thread.

    We have a feature request tracking interest for us to find a line of code that is hitting a run-time error and report it back along side other error information that we see in the logs.

    That ticket ID is SFT-1209, I will submit a vote on your behalf.

    As with other feature requests, we cannot present an ETA as they are fulfilled based on the development team's schedule and priorities. Upon implementation the ticket ID can be found publicly on the Release Notes page of the help guide. I'll provide a link below.

    Release Notes: https://ninjatrader.com/support/help...ease_notes.htm

    I look forward to being of further assistance.

    Comment


      #3
      Old thread but still at the top of google searches.

      Here's how I trap the indicator name and line number using try/catch and debug mode.


      Code:
      try{
      //Problem code
      } catch(Exception Err){Log(Err.ToString(), LogLevel.Warning); }
      From trace file

      With compile debug mode on contains line number
      Code:
      2022-04-22 09:31:31:426 WARNING: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative
      and less than the size of the collection. Parameter name: index    at System.ThrowHelper.ThrowArgumentOutOfRange
      Exception(ExceptionArgument argument, ExceptionResource resource)    at NinjaTrader.NinjaScript.Series`1.set_Item
      (Int32 barsAgo, T value)    at NinjaTrader.NinjaScrip[B]t.Indicators.Customized.PriceMarker.OnBarUpdate()[/B] in
      c:\Users\AdminUser\Documents\NinjaTrader 8\bin\Custom\Indicators\Customized\PriceMarker.c[B]s:line 170[/B]
      With compile debug mode off does not show line number:
      Code:
      2022-04-22 09:36:17:190 WARNING: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative
      and less than the size of the collection. Parameter name: index    at System.ThrowHelper.ThrowArgumentOutOfRange
      Exception(ExceptionArgument argument, ExceptionResource resource)    at NinjaTrader.NinjaScript.Series`1.set_Item(Int32 barsAgo, T value)    
      at NinjaTrader.NinjaScript.Indicators.Customized.PriceMarker.OnBarUpdate()

      Comment


        #4
        Bidder many thanks for the info, it probably will be workaround, i've not noticed that. TNX!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        83 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        45 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        65 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        68 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        56 views
        0 likes
        Last Post CarlTrading  
        Working...
        X