• 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

dll error in installation

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

    dll error in installation

    I worked on some ninjascript and the script works well as an open source but if I compile it into a dll it has and issue stating dll exists. I went online and thought it was the custom enum values created. I encapuslated the enumeration values and I still have this issue.


    I noticed the code uses DeviationType as a parameter for a Points and Percent


    Will Deviation type create this error ?


    If so do I create a custome enum for deviation type and then initialize deviation type.

    #2
    Hello ballboy11,

    There are some considerations when exporting an assembly.
    http://ninjatrader.com/support/helpG...assemblies.htm

    First, are you exporting the assembly and then importing this into a clean environment that does not have the original script?

    Are the enums in a custom namespace but within the file that is being exported?

    What is the error message you are getting?

    Is your script calling drawing objects?
    Are you attempting to loop through drawing objects?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      First, are you exporting the assembly and then importing this into a clean environment that does not have the original script?

      No the user has an old version and is trying to install the new dll

      Are the enums in a custom namespace but within the file that is being exported?
      Yes except the Deviation Type which is within the zigzag indicator

      What is the error message you are getting?
      I will have to get the tracelog from the user

      Is your script calling drawing objects?
      yes

      Are you attempting to loop through drawing objects?
      yes

      This is a zigzag emum when i parsed to find what Deviation Type was.


      Time Category Message
      error CS0246: The type or namespace name 'DeviationType' could not be found (are you missing a using directive or an assembly reference?)

      If I do compile open source it has no errors if I add zigzag.

      I can compile a dll but the user can not install it.
      Last edited by ballboy11; 07-16-2017, 06:27 PM.

      Comment


        #4
        Hello ballboy11,

        Are you using the dynamic type when looping through drawing objects as directed in the guide I have linked you?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          no they are not dymanic. I use a for loop and my tags have names with a count ID.
          I uploaded the error as a png. I was wondering if it is DeviatonType from the ZigZag indicator.
          Attached Files

          Comment


            #6
            enumerations and dll

            Is there a proper procedure creating custom enumeratons. I know it is the enumeration that is causing this problem. I made a new blank indicator and copied the code and when compiling the the emun errors appeared.

            First I had it global before the namespace and I got the error in the old indicator
            Second I created a seperate namespace and still it didn't work.



            public enum eIndicatorType
            {
            SWING,
            ZIGZAG
            }




            public enum eLineLength
            {
            INFINITE,
            UNTIL_NEXT_SIGNAL,
            NUMBER_OF_BARS,
            }

            Comment


              #7
              Hello ballboy11,

              If the script is not importing, likely because of duplicate classnames or enum names, you would need to remove the existing script using those names.

              Are you able to import the script into a clean environment?

              Wrapping the enum in custom namespace also means any calls to that enum must be through that namespace as well.

              For example:

              Code:
              namespace MyCustomIndicatorEnums
              {
              public enum eLineLength
              {
              INFINITE,
              UNTIL_NEXT_SIGNAL,
              NUMBER_OF_BARS,
              }
              }
              Then in the indicator or strategy you may have a public property such as

              Code:
              [NinjaScriptProperty]
              [Display(Name = "e Line Length", Order = 0, GroupName = "Parameters", Description = "The length of the eline")]
              public MyCustomIndicatorEnums.eLineLength ELineLength
              { get; set; }
              If you do not use the dynamic type when looping through drawing objects, after exporting the assembly this will can a runtime error in the script. This is detailed in the documented I have linked you.

              From the help guide:
              "An obstacle arises with traditional typecasting in a compiled assembly, since the NinjaScript Type you attempt to cast will be present in both your DLL and NinjaTrader's Custom.dll assembly."

              (edit)
              Also, you previously mentioned you are using a DeviationType enum, however, you have posted a different enum.
              Are you trying to wrap the DeviationType enum into a namespace?
              Are you no longer getting an error with this?
              What code are you using when creating the public input.
              Last edited by NinjaTrader_ChelseaB; 07-19-2017, 08:31 AM.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hello.

                I have the same problem with custom enum inside indicator: cs script compiled ok, but importing dll in the clean system causing the error.

                Enum definition:
                Code:
                namespace NinjaTrader.NinjaScript.Indicators.My_Indcator_Folder
                {
                    public class My_Indicator : Indicator  
                    {
                        public enum MyEnum_enum
                        {
                             One,  
                             Two,
                             Free    
                        }
                   }
                }
                Enum usage everywhere in code:
                Code:
                NinjaTrader.NinjaScript.Indicators.My_Indcator_Folder.My_Indicator.MyEnum_enum My_Var;
                My_Var = NinjaTrader.NinjaScript.Indicators.My_Indcator_Folder.My_Indicator.MyEnum_enum.One;
                Public property:
                Code:
                        [NinjaScriptProperty]
                        [Display(GroupName="GroupName",    Name="MyEnum"        Order=1)] 
                        public NinjaTrader.NinjaScript.Indicators.My_Indcator_Folder.My_Indicator.MyEnum_enum MyProperty        { get; set; }
                Error while dllimport:
                Error compiling import assembly: c:\Users\username\Documents\NinjaTrader 8\bin\Custom\My_Indicator.cs(36,75 ) : error CS0246: The type or namespace name 'MyEnum_enum' could not be found (are you missing a using directive or an assembly reference?)

                And I have this error for each row where enum used.
                And this has happened on my PC.

                On another PC, where indicator was never installed before, have another error message appears when importing the same dll:
                Import failed, The NinjaScript Archive File may contain duplicate method names that already exist on your PC, modify a method signature that other scripts were dependent on, or be missing a required file on either your PC or in the import archive.

                Please help.
                Last edited by fx.practic; 02-08-2019, 12:30 PM.

                Comment


                  #9
                  Found this thread: https://ninjatrader.com/support/foru...-a-custom-enum

                  Adding this in cs file not helps.
                  Code:
                  using NinjaTrader.NinjaScript.Indicators.My_Indcator_Folder;
                  Will try other specified ways.

                  Comment


                    #10
                    Well, I moved my enum to separate global namespace, out of NinjaTrader namespace:
                    Code:
                        namespace MyProject_enums
                        {
                            public enum MyEnum_enum
                            {
                                One,  
                                Two,
                                Free    
                            }
                        }
                    And, I changed all names accordingly:
                    Code:
                    MyProject_enums.MyEnum_enum My_Var;
                    My_Var = MyProject_enums.MyEnum_enum.One;

                    After that, I got multiple errors in NinjaScript generated code section:

                    The type or namespace name 'My_Indicator' could not be found (are you missing a using directive or an assembly reference?) CS0246

                    NinjaTrader.NinjaScript.Indicators.Indicator.My_In dicator(double, MyProject_enums .MyEnum_enum , int, byte, byte, byte, byte, bool)' is a 'method' but is used like a 'type' CS0118

                    Moving back MyEnum_enum definition from global namespace inside My_Indicator class let indicator compile again.

                    I really stop understanding what is going on.

                    Also, I tried to import dValueArea indicator from the example above - it compiles fine.


                    UPD 01:
                    Changing indicator namespace from NinjaTrader.NinjaScript.Indicators.My_Indcator_Folder to NinjaTrader.NinjaScript.Indicators let it compile well.
                    Tried to recreate folder through NSEditor - it not helps.
                    (!) Moving an indicator by drag-n-drop NSEditor spoils global enum namespace. Looks like unexpected and not correct behavior.


                    UPD 02:
                    Moving dValueArea indicator to sub-namespace (sub-folder) produce same same errors in it (please, look at attachment).
                    Attached Files
                    Last edited by fx.practic; 02-08-2019, 03:01 PM.

                    Comment


                      #11
                      Hello fx.practic,

                      I'm writing to know that your message was seen and we will be following up with our findings. As we are approaching our closing time for the day, we will likely have a response during our business hours on Monday.

                      Thanks in advance for your patience.
                      JimNinjaTrader Customer Service

                      Comment


                        #12
                        Thank You Jim.
                        I am looking forward to here Your advice.
                        Last edited by fx.practic; 02-11-2019, 09:29 AM.

                        Comment


                          #13
                          Hello fx.practic,

                          I am seeing the same symptoms where if we create an enum in a custom namespace and place our NinjaScript in a sub namespace, then the NinjaScript generated code is not including the fully qualified namespace. I am also seeing that if I change the enum to reside globally instead of in the enum's own namespace, then the NinjaScript generated code is correctly applying the fully qualified namespace.

                          I've reported this for further investigation and will update this post as more information becomes available.

                          In the meantime, I would suggest to take either of the approaches with enums:

                          1. If your NinjaScript resides in a sub namespace, use a global enum that does not reside in a separate namespace. Name the enum so it is uniquely associated with your indicator. I.E. MyEnumForThisIndicator. This will help to avoid conflicts if another script uses a different enum with the same name.
                          2. If your NinjaScript does not reside in a sub namespace, you may create a global enum like #1 or create the enum in its own custom namespace.

                          I look forward to being of further assistance.
                          JimNinjaTrader Customer Service

                          Comment


                            #14
                            Hello Jim.
                            Thanks a lot for the answer.
                            Please, please and please - give us the possibility to avoid a mess in public areas.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by TikDaddy, Today, 02:08 PM
                            2 responses
                            8 views
                            0 likes
                            Last Post NinjaTrader_JoshG  
                            Started by Brillo, Today, 01:52 PM
                            1 response
                            13 views
                            0 likes
                            Last Post NinjaTrader_Jim  
                            Started by TazoTodua, 02-09-2018, 08:40 AM
                            10 responses
                            880 views
                            0 likes
                            Last Post NinjaTrader_JoshG  
                            Started by TazoTodua, Yesterday, 04:35 AM
                            6 responses
                            18 views
                            0 likes
                            Last Post eDanny
                            by eDanny
                             
                            Started by MattP, Today, 12:25 PM
                            1 response
                            6 views
                            0 likes
                            Last Post NinjaTrader_PatrickG  
                            Working...
                            X