Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

@Strategy.cs causes compilation problems

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

    @Strategy.cs causes compilation problems

    Hi,

    Problem:
    I found problem with the @Strategy.cs file..
    I was forced to update it with namespace, otherwise NT8 will not compile = reports error.

    This strange behavior started to happen only after I added my own code files (AddOns). This problem does not exist in clean Ninja.

    But we developers should not required to update @Strategy.cs, because this file is replaced with each NT8 release.
    So this needs to be fixed.


    FIX:
    I fixed the problem by replacing 2 occurences of type:
    Code:
    [FONT="Courier New"]Indicator[/FONT]
    with new
    Code:
    [FONT="Courier New"][COLOR="Red"]Indicators.[/COLOR]Indicator[/FONT]

    How to reproduce:
    You can easily reproduce the error.

    I can send complete zipped Custom folder, that is fixed and compiles.
    If you removed the my added namespace OR replace original @Strategy.cs file,
    the compilation problem arises immediately.


    Just send me an email, where I can send to zip file to reproduce this.

    #2
    Hello misova,

    Thank you for your patience.

    Please send the .zip to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H - 1566361' in the subject line.

    Comment


      #3
      Thank you.
      Sent to email with required files and description of the problem...

      Comment


        #4
        Ninja guys informed about result, what caused the problem:

        You cannot organize your files within namespace, that contains name, that already NT8 occupies for its files.

        For example file in this location will not compile:
        Code:
        AddOns\Algoritmix\OpportunityFramework\[COLOR="Blue"]Strategy[/COLOR]\Testing\BaseTestingStrategy.cs
        Problem is with folder name "Strategy"
        The same applies for folder "Indicator".

        Comment


          #5
          can NT check this as part of compilation and raise a error so we don't have to remember this. I am sure over time, somebody will do this mistake again.

          Comment


            #6
            Definitely yes.
            • This shoul be reported by user-friendly error message and
            • requirements for naming folder should be added in the documentation

            Comment


              #7
              Hi Patrick,

              I have to re-open this issue again, because the same problem occurs again,
              despite there is no folder named Indicator or Strategy, that are expected to conflict with NT8 folder names.

              I had to modify @Strategy.cs and add the namespaces again, to make the whole NT8 project compile.

              I submitted the whole Custom folder zipped to our last email communication.

              It is the completely the same problem as previously. I hope it should not be too hard to find the cause.

              Maybe there some other constraints, we developers, are not aware of right now.
              Last edited by misova; 09-11-2016, 10:30 AM.

              Comment


                #8
                Thank you all for your feedback.

                I will look into this further and follow up here.

                Comment


                  #9
                  Patrick resolved the problem and this is explanation:

                  Do not use namespace containing word Indicator, because it conflicts with NT8 files.

                  My problem was, that I had class using this namespace:
                  Code:
                  namespace NinjaTrader.[COLOR="Red"]Indicator[/COLOR]
                  {	
                  	public abstract class MyCustomClass{
                          ....
                  }
                  The word "Indicator" in red color was the problem. When it was changed, it immediately worked again, without any changes required to do in file @Strategy.cs

                  So best overall recommendation is to not use words Strategy, Indicator
                  • do not use it for any folder
                  • do not use it in any C# namespace

                  In case you will do it despite warnings, expect, that compilation error can mislead you, by suggesting to make change (add namespace Indicator on 2 places) in @Strategy.cs file.

                  Changing @Strategy.cs file will fix the problem, but it is not root of the problem. You will do better, if you take it as symptom, that you created folder or namespace containing keywords like "Indicator" or "Strategy". If you fix this instead, you will solve the real problem and you will not need to change @Strategy.cs file.

                  Anyway, changing any file starting with @ is not recommended. These files are under management of NT8 and we should not change them - they can be replaced with each new release of NT8 you install.
                  Last edited by misova; 09-14-2016, 12:41 PM.

                  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