Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Assembly could not be exported.

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

    #16
    Hello iantriestrading,

    It sounds like you did already but did you form it just like this example? If so are you certain that every place the enum is used you have used the fully qualified name, even for public properties and variables?

    Comment


      #17
      Originally posted by NinjaTrader_Jesse View Post
      Hello iantriestrading,

      It sounds like you did already but did you form it just like this example? If so are you certain that every place the enum is used you have used the fully qualified name, even for public properties and variables?

      https://ninjatrader.com/support/help...ned_parame.htm
      Hi Jesse, yes I actually used that SampleUniversalMovingAverage_NT8 example script to help me with this.
      I'm using fully qualified names throughout the indicator and in the strategy that uses it.

      I'm trying commenting out as much as possible now. Coming from Next.js/Javascript/React development, .NET is really frustrating since, if a reference is missing, there is zero information about what is missing. Just a generic error. I guess compilation fails so early there's nothing for Ninjatrader to log either.

      Comment


        #18
        Hi again Jesse,

        I'm getting nowhere.

        I tried moving my types/enums to a shared DLL and that is nice and cleaner since my strategy needs to access those types/enums too. But it didn't help with the weird export error.

        I exported the indicator along with the shared DLL reference containing the types/enums, then imported it.

        Unfortunately I still cannot export the strategy when the indicator is the assembly version. Same error saying I need to ensure I'm including all required components, but no error log with info about what's missing.



        I'm including all of these using statements in the indicator:

        Code:
        using System;
        using System.Collections.Generic;
        using System.ComponentModel;
        using System.ComponentModel.DataAnnotations;
        using System.Linq;
        using System.Text;
        using System.Threading.Tasks;
        using System.Windows;
        using System.Windows.Input;
        using System.Windows.Media;
        using System.Xml.Serialization;
        using Brush = System.Windows.Media.Brush;
        using NinjaTrader.Cbi;
        using NinjaTrader.Core;
        using NinjaTrader.Core.FloatingPoint;
        using NinjaTrader.Data;
        using NinjaTrader.Gui;
        using NinjaTrader.Gui.Chart;
        using NinjaTrader.Gui.SuperDom;
        using NinjaTrader.Gui.Tools;
        using NinjaTrader.NinjaScript;
        using NinjaTrader.NinjaScript.DrawingTools;
        using MyNamespace.Enums;
        using MyNamespace.Types;
        I don't know what to do at this point. I can't really comment stuff out in the strategy much to test as it would require significant refactoring every time that kindof defeats the point of figuring out where the issue is in current code.

        Is there really nothing else I can do to find out what the compiler believes is missing?

        Comment


          #19
          Hello iantriestrading,

          That is not the correct approach, you need to not use the using statements as the sample for enums shows. The purpose of using the fully qualified name everywhere is so that you do not have to use using statements for the custom types at all. When you use using statements that will fail during exports.
          Last edited by NinjaTrader_Jesse; 11-19-2024, 08:34 AM.

          Comment


            #20
            Hi Jesse,
            • I removed the using statements for the enums/types as you instructed, from both my strategy and the indicator, and yes, there are no errors when compiling since I'm using fully qualified names everywhere.
            • I exported indicator as assembly, making sure to include the shared enums/types DLL as reference.
            • I imported the indicator.
            • I attempted to export the strategy with the indicator and the shared enums/types references, and it still fails to export, saying required components are missing, with no error logged.
            At this point I'm stuck. Ryan in the Vendor Program has been waiting for me to send my strategy for QA and I can't even export it. ouch

            Any other ideas? Is it possible for me to add any debug logging to my indicator or strategy, which would show up in Ninjascript output when it's attempting to export to assembly?
            Last edited by iantriestrading; 11-19-2024, 11:18 AM.

            Comment


              #21
              Hello iantriestrading,

              At this point you need to figure out what specific line of code is having an error by using the comment out method. Was it specifically the enum you created and which line in the strategy causes it to not export?

              The way you are exporting the items you should need to add both the dll reference and the indicator to the export screen, are you doing that?

              Comment


                #22
                Hey Jesse,
                1. I'll try the comment-out approach again. I found it challenging to do before because if i comment out one part, it requires me to refactor much of the rest of the code that depended on it, for example.. so ends up seeming like pointless exercise that didn't get anywhere. But I will try again today.
                2. Yes, at the export screen, I am adding my strategy, plus the DLL reference and the indicator reference.

                Comment


                  #23
                  Hello iantriestrading,

                  Using the comment method should not require any refactoring, you would just need to comment out the other code which uses what you commented out. For example comment out all logic, variables and properties in the script to leave the base class and then just uncomment one variable that uses your custom type. Try the export and make sure that works. Continue to do that for any custom type variables you may be using. Continue doing this for public properties next. You shouldn't need to uncomment your normal logic unless some part of that is required which in that case you should have uncommented the required variables and properties at that point to allow that portion to also be uncommented. it is a process to repeat the export but that will let you find the specific line of code with the problem. Once that is known we can look at what code is holding up the export to get a better idea of what needs to be done.

                  Comment


                    #24
                    Thank you Jesse, I'm working through it now!

                    Comment


                      #25
                      Hi Jesse,

                      At this point, my indicator is completely empty except for setDefaults. Everything else is commented out.
                      I've attached the current indicator code with commented parts removed for you.
                      Neither of them reference my custom enums/types anymore at all.

                      Am I missing a using statement? Do I have a using statement I should NOT have in there?

                      I still get the error "Assembly could not be exported. Please ensure all required components are included." when I try to export this strategy with the assembly version of this empty indicator
                      Attached Files
                      Last edited by iantriestrading; 11-19-2024, 02:09 PM.

                      Comment


                        #26
                        Hello iantriestrading,

                        I would suggest doing a clean install so no third party scripts are imported and then try the same test, you should able to reference an indicator from a strategy and export it.

                        I would also suggest using the NinjaScript editor to create a new indicator, compile and then reference that in the strategy builder so the default file structure is added for both scripts. The previous samples you attached have different #regions than the default files would have and the indicator is missing the required code at the bottom. If you are generating the scripts in some other way please make sure to use the platform to make the files initially and do not make any changes to the files.

                        Use the following steps to do a clean user folder test.
                        1. Exit NinjaTrader
                        2. Open the Documents folder
                        3. Rename the NinjaTrader 8 folder to NinjaTrader 8 Old
                        4. Download the installer from https://account.ninjatrader.com/download
                        5. Install the platform, this will create a new user folder.
                        6. Open the platform and import any of the items that you need

                        To revert back to your previous data use the following steps.
                        1. Exit NinjaTrader
                        2. Open the Documents folder
                        3. Rename the NinjaTrader 8 folder to NinjaTrader 8 Clean
                        4. Rename the NinjaTrader 8 Old folder to NinjaTrader 8

                        NinjaTrader looks for the folder named NinjaTrader 8 for your user data.

                        Comment


                          #27
                          Hey Jesse,
                          • Using only NinjaScript Editor, I tried creating a completely new empty/default strategy, and a new default indicator that does nothing.
                          • I exported the indicator as assembly, excluded from compiling, then imported the indicator.
                          • I added the indicator to the strategy
                          • I attempted to export the strategy with indicator as reference.
                          • I still get the same error.
                          After all this, looks like something in my NT8 installation is corrupt after all. Wow.

                          I'm now trying to run the installer but it ends with error "Ninjatrader Setup Wizard ended prematurely because of an error."

                          Never encountered this one before. Windows did complete some updates last week. There are no updates pending.

                          Comment


                            #28
                            Hey Jesse,

                            I'm sure you will be annoyed as I am to find out the issue was not in my code you have been trying to help me debug.

                            I had to do a clean install of Ninjatrader and restore all my settings/workspaces/templates.
                            • First I was able to export the test strategy + assembly version of test indicator
                            • Then I successfully exported the full strategy + assembly version of the full real indicator.
                            So... SUCCESS!

                            Thanks for all your help, seriously.

                            Comment


                              #29
                              Hi Jesse,

                              I hope you had a good weekend - Unfortunately I'm still having an issue. I can export my strategy and the accompanying custom indicators without errors.

                              When I import the .zip into Ninjatrader, it says import was successful, but my strategy doesn't show up in the strategies list anywhere, even after restarting Ninjatrader.

                              I have no idea how to start debugging this one... Any hints would be appreciated.

                              Update: I am not sure what changed, but I can now see the strategy in the strategy list and add it to a chart. But I cannot activate it. It immediately terminates with error "Error on calling 'OnStateChange' method: An unexpected exception occurred while binding a dynamic operation."

                              I'm guessing it is caused by my obfuscation missing a method name exclusion or something. Is that a good place to start?
                              ​
                              Last edited by iantriestrading; 11-26-2024, 08:26 AM.

                              Comment


                                #30
                                Hello iantriestrading,

                                That would be based on something being done in your strategies OnStateChange method. You will need to use the comment method again to find what specific line of code is having an issue to continue troubleshooting this.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                608 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                355 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                105 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                560 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                561 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X