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 trilliantrader, Today, 08:16 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by bill2023, Yesterday, 08:51 AM
        3 responses
        20 views
        0 likes
        Last Post bltdavid  
        Started by yertle, Today, 08:38 AM
        0 responses
        4 views
        0 likes
        Last Post yertle
        by yertle
         
        Started by Mestor, 03-10-2023, 01:50 AM
        15 responses
        379 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by samish18, Yesterday, 08:57 AM
        10 responses
        28 views
        0 likes
        Last Post samish18  
        Working...
        X