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

Error CS0115 on Dispose()

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

    Error CS0115 on Dispose()

    Dear Support,

    I am converting a timer indicator to NT8 and on compile getting Error CS115 on trying to override Dispose() in the following code:

    Code:
          public override void Dispose()
            {
                if (timer != null)
                {
                    timer.Enabled = false;
                    timer = null;
                }
               base.Dispose();
            }
    Unfortunately, Error CS0115 (no suitable method found to override) is not documented and the code breaking has very little detail.

    Any idea to resolve this error is appreciated.

    Many thanks.

    #2
    Hello,

    Thank you for the inquiry.

    It looks like this override didn't make it into the code breaking changes guide, you would need to utilize the Terminated state in NT8 for cleanup instead.



    As terminated gets called for menu instances where your timer may not have been created or started, you may additionally need to check for null in this state just as you already are:

    Code:
    else if(State == State.Terminated)
    {
         if (timer != null)
         {
              timer.Stop();
              timer.Enabled = false;
              timer = null;
         }
    }
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello,

      Thank you for the inquiry.

      It looks like this override didn't make it into the code breaking changes guide, you would need to utilize the Terminated state in NT8 for cleanup instead.



      As terminated gets called for menu instances where your timer may not have been created or started, you may additionally need to check for null in this state just as you already are:

      Code:
      else if(State == State.Terminated)
      {
           if (timer != null)
           {
                timer.Stop();
                timer.Enabled = false;
                timer = null;
           }
      }
      I look forward to being of further assistance.
      Thank you jesse,

      The implementation took care of the only error that I had but now generates a few new errors related to "graphics.DrawString()" for which I see no code breaking information.

      Please see the block of script under "on render" as related to "graphics" in the attached file, specially lines 113 -130 area.

      Many thanks.
      Attached Files

      Comment


        #4
        Hello aligator,

        Overriding the Plot method and custom rendering with the graphics library is not supported for NinjaTrader 7 and is not documented.

        Because of this, there are no code breaking changes documented as this was never supported for NinjaTrader 7.

        Rendering is now supported for NinjaTrader 8 and done in OnRender().

        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Johnny Santiago, 10-11-2019, 09:21 AM
        95 responses
        6,193 views
        0 likes
        Last Post xiinteractive  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        2 responses
        11 views
        0 likes
        Last Post xiinteractive  
        Started by Irukandji, Today, 09:34 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by RubenCazorla, Today, 09:07 AM
        1 response
        5 views
        0 likes
        Last Post RubenCazorla  
        Started by TraderBCL, Today, 04:38 AM
        3 responses
        25 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X