• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.

    http://ninjatrader.com/support/helpG...=onstatechange

    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.

      http://ninjatrader.com/support/helpG...=onstatechange

      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().
        http://ninjatrader.com/support/helpG.../rendering.htm
        http://ninjatrader.com/support/helpG..._reference.htm
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sisenberg, Today, 07:29 AM
        1 response
        6 views
        0 likes
        Last Post sisenberg  
        Started by Oceans, Today, 02:22 AM
        2 responses
        22 views
        0 likes
        Last Post Oceans
        by Oceans
         
        Started by sisenberg, Yesterday, 08:06 PM
        1 response
        16 views
        0 likes
        Last Post sisenberg  
        Started by PLeary, Today, 06:25 AM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_SergeyS  
        Started by sergey_z, Today, 06:17 AM
        0 responses
        4 views
        0 likes
        Last Post sergey_z  
        Working...
        X