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 bortz, 11-06-2023, 08:04 AM
        47 responses
        1,603 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        8 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        18 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        4 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        12 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X