Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NTB6 - Issue of building project in VS

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

    NTB6 - Issue of building project in VS

    Hello,

    Reproduced it in VS 2013 and VS 2015.

    Steps:
    Open NS Editor, set to debug mode.
    Open Project in VS, make some changes to strategy, and build the project. You will get message in VS to reload project (because it was modified by NT).

    Result - I see my strategy becomes automatically "Excluded" from the project in Visual Studio - and then I have to manually include it again into the project. Reproduced it few times with both versions of VS.

    Really annoying to include file back to VS after every build. Plus there is a problem when using external monitor - getting out of range error in Strategy Analyzer after every build. - "Unhandled exception: Value does not fall within expected range."

    Thanks

    #2
    I have that problem too. What's more, if I change the code in VS and save the file, I get a lot of errors in NS Editor. To get rid of them I have to close NT, delete NinjaTrader.Custom.dll, delete "NinjaScript generated code" in my .cs file, then start NT again.

    So to develop in VS, I have to exclude my files from compilation or to develop while NT is not running. But if I exclude the files from compilation they are renamed by NT, and it's very inconvenient again.
    Last edited by quicktrick; 11-02-2015, 01:22 AM.

    Comment


      #3
      Not sure what you guys are running into but I'm using 2015 and don't have any of those issues.

      Tip:

      NT does not use the project file for compilation - it sends all the files to csc directly. This means if you are only making changes in VS, you can ignore all the project reload requests - you already have the up to date project. You only need the file changes - when NT updates the generated code (which I found doesn't really work - have to make a change in NS Editor to get a newly added indicator's generated code show in VS).

      Comment


        #4
        Problem is I want to debug NT script in Strategy analyzer after I make changes in VS which requires reloading project in NT for debugger to work. And when reloading file in VS gets excluded, and then debugging won't always work.. So it becomes frustrating cycle giving all these pop up errors every time when trying to debug...
        NT 7 doesn't have that issue...
        Last edited by music_p13; 11-02-2015, 08:33 AM.

        Comment


          #5
          Originally posted by wbennettjr View Post
          Not sure what you guys are running into but I'm using 2015 and don't have any of those issues.

          Tip:

          NT does not use the project file for compilation - it sends all the files to csc directly. This means if you are only making changes in VS, you can ignore all the project reload requests - you already have the up to date project. You only need the file changes - when NT updates the generated code (which I found doesn't really work - have to make a change in NS Editor to get a newly added indicator's generated code show in VS).
          It seems the problem appears when "Debug mode" is on. And one more thing. After I save the file in VS, NT not only shows a lot of errors which don't exist in reality, but sometimes it duplicates the developing .cs file in the Documents\NinjaTrader 8\bin\Custom\ folder and includes it in the compilation. So I not only have to delete NinjaTrader.Custom.dll and "NinjaScript generated code", but I also have to delete the .cs copy in Documents\NinjaTrader 8\bin\Custom\

          Comment


            #6
            Are you sure you don't have some kind of backup/replication service running? I compile only in Debug Mode and don't have those issues. I would double check your VS settings to see if it's making those duplicates. Are you using ReSharper?

            One thing you can try is to create a new file using Notepad. If you experience the same issues, then it's not VS. I would then run a file monitor to see what is actually creating the duplicate file - I doubt it's from NT.

            What are the errors exactly?

            Comment


              #7
              I may be missing something but what I'm saying is: If you are not making project/solution level changes (adding/removing files) outside of VS, there is no need to reload the project in VS. If you are making all your changes in VS - you already have the most up to date project.

              What is "query analyzer"? The only issue I have is that the generated code does not show up for newly added indicators. The fix is to make a change in the NS Editor and compile (and I think just closing and reopening the file in VS should work also).

              I don't understand your workflow - maybe because I don't know what query analyzer is. For me, I make a change in VS, NT automatically compiles, I press F5 on the chart to refresh. If I want to debug, I make sure the generated code is showing in VS (otherwise breakpoints will be disabled), set my breakpoints if needed, attach to NT, press F5 on the chart to refresh if needed.

              Are you doing something different? If you wouldn't mind being a little bit more clear about your workflow, maybe I can spot where the issue is; otherwise, one of the ninjas would have to help you.

              Comment


                #8
                Yes, I am using a Re-Sharper - but that is not an issue. I just uninstalled it but still getting same issue - after building project in VS - getting "Reload All" message from NT, so after reloading files - my strategy file automatically becomes excluded from VS project.

                Error I am getting: out of range error in Strategy Analyzer after every compilation build. - "Unhandled exception: Value does not fall within expected range."

                I also tried Removing my original strategy from NT project from NT program. Then I re-opened project by clicking VS button in NT - I saw that project loaded correctly.

                Then I made change in VS - when making change in VS it automatically triggers NT compilation - so got message to reload everything which I did. And - noticed same bad behavior (with resharper uninstalled).

                Comment


                  #9
                  Originally posted by music_p13 View Post
                  Yes, I am using a Re-Sharper - but that is not an issue. I just uninstalled it but still getting same issue - after building project in VS - getting "Reload All" message from NT, so after reloading files - my strategy file automatically becomes excluded from VS project.
                  I'm not using ReSharper, and I have the same issue. While in "Debug mode" after saving the file in VS, NT gives "Reload All" message and then automatically excludes my file from VS project. When I add the file to VS project manually, there appear lots of errors in NS Editor like "The type 'NinjaTrader.NinjaScript.Indicators.Indicator' already contains a definition for 'cacheMyIndy'", "The type 'NinjaTrader.NinjaScript.Indicators.Indicator' already defines a member called 'MyIndy' with the same parameter types" and so on.

                  Comment


                    #10
                    To get rid of that error you will need to include your files in VS project that become auto-excluded after NT compiles. But then after saving in VS that cycle goes again...

                    Also noticed that strategy analyzer doesn't get updated when removing existing strategy and adding new one (something not getting recompiled in NT) - but that is a minor issue compared to not being easily update/debug strategy. I wonder if it is ntb6 related and don't remember these issues in ntb5...

                    Comment


                      #11
                      I think I found a way to bypass the problem of auto-excluding the files from VS project after NT compilation.

                      1. I closed NT and deleted everything I mentioned previously. I also deleted NinjaTrader.Custom.csproj and the VS files (.sln, .suo, .xml).
                      2. Then I launched NT B6's installer and repaired the installation.
                      3. After that I started NT and compiled my indies.
                      4. Then I opened the project in VS and (!) saved it under another name.
                      5. Lastly I closed the VS project and saved the solution.

                      Now I'm using my new solution and so far I don't have any problem with reloading the project and auto-excluding the files from it. The debugger is working too.

                      Comment


                        #12
                        Originally posted by quicktrick View Post
                        I think I found a way to bypass the problem of auto-excluding the files from VS project after NT compilation.

                        1. I closed NT and deleted everything I mentioned previously. I also deleted NinjaTrader.Custom.csproj and the VS files (.sln, .suo, .xml).
                        2. Then I launched NT B6's installer and repaired the installation.
                        3. After that I started NT and compiled my indies.
                        4. Then I opened the project in VS and (!) saved it under another name.
                        5. Lastly I closed the VS project and saved the solution.

                        Now I'm using my new solution and so far I don't have any problem with reloading the project and auto-excluding the files from it. The debugger is working too.
                        Thanks a lot - that did the trick for me too... Basically I now keep NT8 project separate from VS project - thus there are no conflicts and no "Reload" messages - so can work now 100% from VS and debug works normally now...
                        Saved my day

                        Comment


                          #13
                          As long as you don't make changes in NT as well this should be fine (I had done the same for NT7 - haven't needed to for NT8 though).

                          When you create a new indicator, does the generated code update automatically? That is the one problem I have. I was thinking of creating a Roslyn code fix to generate the code myself since it's much more simple now than it was in NT7.

                          Comment


                            #14
                            Hello,

                            I wanted to mention I have seen this behavior where scripts are excluded from the project in VS. After included them and making any changes, this causes NinjaTrader to re-compile and reload the project which has them excluded again.

                            Typically, opening the script in the NinjaTrader Editor and then compiling that script from the NinjaTrader Editor should cause the file to be included when NinjaTrader saves the project.

                            Please let me know if this does not work.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Originally posted by NinjaTrader_ChelseaB View Post
                              Hello,
                              Typically, opening the script in the NinjaTrader Editor and then compiling that script from the NinjaTrader Editor should cause the file to be included when NinjaTrader saves the project.

                              Please let me know if this does not work.
                              NT not always re-generates "NinjaScript generated code" and after making changes in VS there appear errors, and then NT excludes the file from the project. To get rid of that you have to close NS Editor and then delete "NinjaScript generated code".

                              I've noticed also that it's better not to have NS Editor open while making changes to the code in VS.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by algospoke, 04-17-2024, 06:40 PM
                              6 responses
                              48 views
                              0 likes
                              Last Post algospoke  
                              Started by arvidvanstaey, Today, 02:19 PM
                              4 responses
                              11 views
                              0 likes
                              Last Post arvidvanstaey  
                              Started by samish18, 04-17-2024, 08:57 AM
                              16 responses
                              61 views
                              0 likes
                              Last Post samish18  
                              Started by jordanq2, Today, 03:10 PM
                              2 responses
                              9 views
                              0 likes
                              Last Post jordanq2  
                              Started by traderqz, Today, 12:06 AM
                              10 responses
                              21 views
                              0 likes
                              Last Post traderqz  
                              Working...
                              X