Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    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 AttiM, 02-14-2024, 05:20 PM
        12 responses
        213 views
        0 likes
        Last Post DrakeiJosh  
        Started by cre8able, 02-11-2023, 05:43 PM
        3 responses
        237 views
        0 likes
        Last Post rhubear
        by rhubear
         
        Started by frslvr, 04-11-2024, 07:26 AM
        8 responses
        116 views
        1 like
        Last Post NinjaTrader_BrandonH  
        Started by stafe, 04-15-2024, 08:34 PM
        10 responses
        47 views
        0 likes
        Last Post stafe
        by stafe
         
        Started by rocketman7, Today, 09:41 AM
        3 responses
        11 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X