Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaScript Editor error "Unhandled exception: Index was out of range..."

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

    NinjaScript Editor error "Unhandled exception: Index was out of range..."

    Good Morning!

    Opening NT* to a completely empty workspace
    Zero Charts Open
    Zero Strategies loaded

    Repeatedly after reboots and reopening NinjaTrader

    Open a new instance of NinjaScript Editor > open any Indicator file (SMA, ROC, ATR, etc) and the following error message appears and is logged. ONLY for the first file opened.
    .
    5/15/2020 7:24 Default Unhandled exception: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
    .

    Close NinjaScript Editor

    Open a new instance of NinjaScript Editor and open any Strategy file. The message does not appear.
    Now in that same instance open an Indicator file (e.g. ATR or anything). The message "Unhandled exception: Index was out of range" appears.


    What is the best way to repair my install?

    Thanks!
    Last edited by hedgeplay; 05-15-2020, 06:46 AM.

    #2
    Attaching a screenshot of the log
    Attached Files

    Comment


      #3
      Hello hedgeplay,

      Thanks for your post.

      You can download an installer from the link below and run a Repair operation to attempt a repair of the installation.

      Download - https://ninjatrader.com/PlatformDirect

      If you are still seeing issues, I may suggest setting up a clean environment and then moving your NinjaScripts over from the old installation's Documents\NinjaTrader 8\bin\Custom folder. If you identify something specific that incurs this issue, please let us know.

      If you need additional help, please write in to platformsupport [at] ninjatrader [dot] com to request a remote support session.

      Clean Environment Test:

      Creating a clean environment can be done by following the steps below:
      1. Close NinjaTrader 8, and rename the "NinjaTrader 8" folder in My Documents to something like: "NinjaTrader 8 OLD"
      2. Uninstall NinjaTrader from the Windows Control Panel and reinstall using the installer from http://ninjatrader.com/PlatformDirect
      3. Attempt to reproduce the issue with the NinjaScript Editor. IF all is well, please bring in your scripts from the old installation's Documents\NinjaTrader 8\bin\Custom folder.
      Note: Custom assemblies (DLL's) in the bin\Custom folder will need to have a reference added in the NinjaScript Editor. (NinjaScript Editor > Right Click > References > add)

      If you ever need to switch back to your original platform, you may do so by closing NinjaTrader and swapping the platform folder names.

      For example, Close NinjaTrader and rename the new "NinjaTrader 8" folder to "NinjaTrader 8 NEW" and the "NinjaTrader 8 OLD" folder to "NinjaTrader 8." Then restart the platform. Simply put: NinjaTrader 8 will always load the "NinjaTrader 8" folder in My Documents.

      We look forward to assisting.
      JimNinjaTrader Customer Service

      Comment


        #4

        Thanks much Jim!

        Comment


          #5
          Hi Jim,

          I am replying to provide an update and ask two followup questions.


          The UPDATE

          I spent a whole day working through to restore my environment. The upside is I learned a lot about the underbelly of NT and things to consider for ongoing operational management of NT deployments.

          I executed repeated uninstalls > clean re-installs > and repeated attempts for restores via various methods.

          - Restores from recent backups failed because "your NinjaScript files are corrupted"

          - Older restores worked fine as a base starting point but after using File Explorer to copy in even a small amount of NT strategies and indicators
          -- the same Index error above occurred
          -- I saw compile fails from significant namespace dependency issues

          - So "Ok fine, I will re-import a bunch of indicators from Zip files using the front door method" ... the same indexing error above re-occurred while importing to completely fresh NT8 installs. Doh!

          - Having more confidence at being able to keep NT8 operating or restored when needed despite the error I decided to keep using NT8 and start data gathering to come back and request help / a review of my log files, etc to help me find and resolve the issue. But the indexing issue above stopped occurring and so far has not returned.


          The FOLLOWUP QUESTIONS

          1. At the moment I am based to ignore the Indexing issue unless it re-occurs. Based on what I wrote just above are you concerned that I may have an ongoing issue with my environment that needs attention now or I am at low risk and should just continue to use the platform as normal using a wait and see approach?

          2. With an eye toward preventing another day long exercises to re-import all my NinjaScript one at a time.. Should I see restoration from a backup fail again because of corruption with my NinjaScript files or restoration of files that had not yet made it to a backup what are the best practice methods for bulk import or restoration of DLLs and Ninjascript under custom/bin?

          Thanks!

          Comment


            #6
            Hello hedgeplay,


            1. At the moment I am based to ignore the Indexing issue unless it re-occurs. Based on what I wrote just above are you concerned that I may have an ongoing issue with my environment that needs attention now or I am at low risk and should just continue to use the platform as normal using a wait and see approach?
            The indexing error could have been from an installation issue or from a custom AddOn. Setting up the clean environment and observing the issue does not occur there should give reassurance for an installation issue. Keeping track of the AddOns you import to note if one creates the issue would determine which one creates the issue so that party can be informed. I do not have concerns that this is would be attributed to an installation issue and the Clean Environment test can confirm that.

            2. With an eye toward preventing another day long exercises to re-import all my NinjaScript one at a time.. Should I see restoration from a backup fail again because of corruption with my NinjaScript files or restoration of files that had not yet made it to a backup what are the best practice methods for bulk import or restoration of DLLs and Ninjascript under custom/bin?
            Backup files would be the advised way to store NinjaScripts, templates and workspaces in bulk should you need to restore at a given point. Testing items individually in a clean environment would be a scientific approach to diagnose issues that may be stemming from those components, or if the issue was at heart platform related.

            You could copy your DLL files over to the bin/Custom folder manually and add references to those DLL's in the NinjaScript Editor if you want to move them over in bulk, but be advised, the point of testing in the clean environment is to see which specific components may be causing an issue. When adding references, I suggest checking the References of your old installation so you know what references should be added in the new installation. (NinjaScript Editor > Right Click > References)

            If you copy your DLL's in bulk, I suggest doing so in groups, and if you see the issue come back, remove that whole group and test those individually.

            We look forward to assisting.
            JimNinjaTrader Customer Service

            Comment


              #7
              Thanks Jim,

              All good points and what I spend the day doing.

              Six full uninstall > Reboot > Re-install to gain clean environments to work from, A/B testing, Binary Search to try and narrow it down until I realized it was 100% of the Indicator *.cs files and only 20% of the Strategy files I was trying to copy over into bin/custom/Indicators etc. and recompile.

              During the four days prior the Index error message had a !00% hit on first open of an Indicator for viewing or editing in the NinjaTrader Ediitor regardless if I had opened any non Indicator *.cs files prior or not. Error on occurred on first open of an Indicator *.cs and no other issues were observed.

              The next day with numerous manual copies of clean install directories, the best new custom/bin configuration in hand and knowing I could recover again if I needed to I decided to just work with NT8 despite the error and start more data gathering to support issue resolution.

              The strange thing... For another full day or two the error continued and then just suddenly stopped as if NT8 self-healed.

              Error has not surfaced since so it was time to write up this After Action Review and firm up any remaining items for closure.

              QUESTION
              For the future .. Would the log files, and which log files, identify any specific details that could help me sort the problem on the fly?

              Thanks!



              Comment


                #8
                Hello hedgeplay,

                Sending in your log and trace files to platformsupport [at] ninjatrader [dot] com will allow us to review the error further and the full error/stack trace can give hints for a resolution which can expedite this process. I would recommend doing so in the future should you run into other issues.

                If we suspect an installation issue or AddOn related issue, we may ask to perform the same steps to test in a clean environment (rename NinjaTrader 8 documents folder, then uninstall/reinstall) but if we have the log/trace and there is something obvious, we can likely spot it.

                We look forward to assisting.
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Thanks again Jim!

                  Comment


                    #10
                    I'm developing a new Indicator (call it FooIndicator), and I ran into this error. What I had done was decided I want to start fresh and re-walk through the wizard, so I shut down the ControlCenter (i.e. everything!) and then renamed the file to "FooIndicator_Old.cs" in the custom indicator source folder. I stepped through the wizard giving my indicator the name I wanted, "FooIndicator", and got this error when I clicked "Finish" with the Wizard.

                    I figured out that even though I had renamed the file, the "FooIndicator_Old.cs" file still had the original class name (FooIndicator) and, after the wizard ran, the NinjaScript editor must have gagged because two different custom scripts claimed to be the "right way" to create a FooIndicator class.

                    Ya that seemed bad. So I shut everything down and removed both files, clean - I didn't have any of my own custom .cs files in the Indicator folder.

                    At that point I tried to bring NinjaTrader up. When I brought up a new NinjaScript Editor window, I got the error again.

                    I shut it all down again. None of my custom files were there.

                    Acting on a hunch, I checked - I had created a custom workspace. Maybe something weird had been stuck in there?
                    I deleted the custom workspace, exited ControlCenter and came back in.

                    Better shape: Now I could bring up NinjaScript editor without an error.

                    I checked the default chart that had been brought up. Again essentially acting on a hunch, I typed Control-I to show me the list of current known Indicators.

                    No!! My custom indicator was STILL IN THE LIST of "Available" indicators, even showing its list of configurable Properties.

                    I think something's being cached here. As I mentioned, my custom indicator .cs files are GONE - not in the custom folder. NT is getting my code from somewhere else! Perhaps this caching is what's causing the problem?

                    Comment


                      #11
                      Hello dween,

                      NinjaScript source code compiles into the Documents\NinjaTrader 8\bin\Custom\NinjaTrader.Custom.dll file. If this file is still present, you will see older builds of your indicators that have been built into that DLL. Aka, the last time it was compiled.

                      Also note that any custom DLL's installed will also include their indicators.

                      So if you do not have the source code, the indicator would be from one of those DLL's.

                      Regarding the source code missing, this can come up if there is Cloud Syncing software that is possibly syncing files to the platform folder that it thinks should be removed.

                      We recommend disabling Cloud Syncing software when using NinjaTrader, or to add exceptions to Cloud Syncing software to prevent syncing Documents\NinjaTrader 8\

                      You may test saving a new indicator when you have this software disabled, and the files will persist.
                      JimNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by DavidHP, Today, 07:56 AM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_Erick  
                      Started by kujista, Today, 06:23 AM
                      3 responses
                      9 views
                      0 likes
                      Last Post kujista
                      by kujista
                       
                      Started by Mindset, Yesterday, 02:04 AM
                      2 responses
                      18 views
                      0 likes
                      Last Post NinjaTrader_RyanS  
                      Started by f.saeidi, Today, 08:03 AM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by samish18, 04-17-2024, 08:57 AM
                      15 responses
                      53 views
                      0 likes
                      Last Post NinjaTrader_BrandonH  
                      Working...
                      X