Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Import compilation error on successfully compiled indicator

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

    Import compilation error on successfully compiled indicator

    I created several indicators that I compiled and tested successfully on my PC. I packaged the indicators in an export assembly and forwarded to a few colleagues for testing. One colleague imported the file without a problem. Two others had import failures with error messages in the log saying: “Error compiling import assembly … : Error CS0029 Cannot implicitly convert type ‘string to type ‘WSLineStyle’.
    WSLineStyle is the enum I use in one indicator to validate the horizontal line style parameter entered by the user, e.g. “Dash”, “Solid”, etc.
    When I remove that indicator from the assembly, the import works for the other colleagues.

    What I can’t understand is :
    (a) Why the import compilation fails when the compilation of that indicator works correctly on my PC. To be honest I’m not sure why the import has to re-compile a compiled assembly anyway.

    (b) Why the import worked for one person but not the others. Is it possible they have different compiler versions?
    Thanks for any explanation.

    #2
    Hello Scotty33,

    Thank you for your post.

    What version of the platform are the colleagues that had issues running? This can be found under Help > About - the current version is 8.0.25.0.

    Is that WSLineStyle type used elsewhere? Another script the user has installed, perhaps?

    Have you tried using a custom namespace with the enum?

    Thanks in advance; I look forward to assisting further.

    Comment


      #3
      Hello Kate,
      Thanks for your post.
      I've heard back from one of the two users whose import failed. He's on 8.0.24.1. The user who successfully imported the file is on 8.0.25.0, so it may be a case of just asking everyone to move to the latest version.
      The users are not aware of any other scripts using the WSLineStyle type.
      I haven't tried using a custom namespace with the enum. If the move to the latest version doesn't solve it, then I'll try that.
      I'll keep you posted on progress.

      Comment


        #4
        Hello Kate,
        I checked with two other users where the import failed and both are running version 8.0.25.0.
        I tried creating a custom namespace (_WSLineEnums) for the enums and that generated the following import error:
        Error CS1503 Cannot convert from ‘string’ to ‘_WSLineEnums.WSLineStyle1’.
        As the number of possible values for the line style is small, I removed the use of enums and defined the input parameter (now renamed as WSLevelStyle) as a string with the initial value “Dash” and then checked for each of the possible values entered in the parameter. This time the import failed with the following error:
        Error CS1912 Duplicate initialization of member ‘WSLevelStyle’
        There is only one line in the code where a value is assigned to WSLevelStyle and that is the initial parameter value in State.SetDefaults. The remaining references to the variable are of the form:
        if WSLevelStyle == “DashDot” etc.

        I’ve changed the name of the variable to ensure that it won’t duplicate the name of a variable in another script, but the import always fails with the duplicate initialization error.

        Question: I assume the Export function does its own compilation before saying the assembly is valid for export, so does this mean that the Import function uses a different compiler even though the source PC (mine) and the target PC of the user are both running version 8.0.25.0?


        Thanks in advance for any advice.

        Comment


          #5
          Hello Scotty33,

          Thank you for your reply.

          No, the import would use the same compiler.

          There are not older versions of the assembly already within the importing users' platforms, are there? If so, have them remove them using Remove NinjaScript Assembly then have them try to reimport.

          If that's not effective, at this point we'd really need to see a reduced open source test script and an exported assembly of the same script to test on our end and see what may be causing the issue. You can email us directly at scriptingsupport [at] ninjatrader [dot] com with "3507808 ATTN Kate W." in the subject line and a link to this thread in the email body. All code will be kept confidential.

          Thanks in advance; I look forward to assisting you further.

          Comment


            #6
            Hello Kate,
            Removing the previous copy of the assembly made no difference.
            Just to clarify what I need to send you, the assembly contains several indicators, but only one indicator appears to be causing the import compilation failure. Do you need the source code for just that indicator together with an assembly that contains only that indicator? Or do you need the full assembly with all indicators?

            Comment


              #7
              Hello Scotty33,

              Thank you for your reply.

              Let's try with just the indicator that seems to be throwing the errors first and see if we can replicate with just that one as source and as a compiled assembly.

              Thanks in advance; I look forward to assisting you further.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              581 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              338 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              554 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              552 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X