Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Request compilation using .Net 4.6

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

    Request compilation using .Net 4.6

    Can the custom DLL be compiled with .Net 4.6?

    I had a conversation with ninja Brett and he mentioned concerns about upgrading NT because the new framework is not yet widespread and that there was a patch for a serious bug released just a month ago.

    Unless I'm mistaken, NT itself does not have to be upgraded to use .Net 4.6. All that is needed is the option for the NinjaTrader.Custom.dll to be compiled using .Net 4.6. What I think should work is that a list of the installed compilers can be retrieved from the machine. The default can be .Net 4.5 but allow the user to choose which compiler they want to use. Alternatively, there could just be a dialog that lets the user select the compiler executable (csc.exe) they want to use. The rest of the application should not care what version of the framework an assembly is compiled with.

    With this approach, each user is free to use whatever compiler he/she chooses without affecting the application or other users and we don't have to wait for an NT upgrade to be able to use new .Net releases. I think the second option should be really easy to implement.

    #2
    Originally posted by wbennettjr View Post
    Can the custom DLL be compiled with .Net 4.6?

    I had a conversation with ninja Brett and he mentioned concerns about upgrading NT because the new framework is not yet widespread and that there was a patch for a serious bug released just a month ago.

    .
    And the bug affects NT how?

    I googled 4.5 to 4.6 bugs, and all I get is about bugs in 4.6 and why I shouldn't upgrade.

    Comment


      #3
      I think it's a bit overblown. The bugs I've seen (3) all happen with the new RyuJIT compiler and I think only for 64 bit apps. From what I understand, RyuJIT is new to 4.6 and can be disabled to get the same performance as 4.5 that did not have it.

      People crave attention and will always post "catchy" phrases about why you should wait on something since that's going to get more hits. Had I listened to all these websites and not evaluated for myself, I probably would just now be comfortable in upgrading to .Net 2.0! Wait... Is that stable yet?

      As I stated though, NT itself does not need to be upgraded. The framework is quite young for the main application to adopt. Given NT8 is still in beta and probably won't be released for a while, maybe the situation will change by then.
      Last edited by wbennettjr; 10-16-2015, 06:56 AM.

      Comment


        #4
        Ok. Maybe I wasn't so crazy after all (remains to be seen). I created the following test and it worked fine. I suspect NT is loading the NinjaTrader.Custom.dll dynamically so it shouldn't be a problem. Hopefully this is doable or I'll be sad for months.

        Console app targeting 4.5.2 (This would be the NT main app):
        Code:
         using System.Reflection;
         namespace Console45
        {
            class Program
            {
                 static void Main(string[] args)
                {
                    var lib = Assembly.LoadFrom("Library46.dll");
                    var class1 = lib.GetType("Library46.Class1");
                    var test = class1.GetMethod("Test", BindingFlags.Static | BindingFlags.Public);
                    test.Invoke(null, new object[0]);
                }
            }
        }
        Library targeting 4.6 (This would be NinjaTrader.Custom.dll):
        Code:
         using System;
         namespace Library46
        {
            public static class Class1
            {
                public static void Test()
                {
                    Console.WriteLine("Testing");
                }
            }
        }
        Last edited by wbennettjr; 10-16-2015, 08:34 AM.

        Comment


          #5
          As a proof that this works, I changed the NinjaTrader.Custom project to target .Net 4.6. I then added the following property to an indicator:

          Code:
           [XmlIgnore]
          public string Version { get; } = ".Net 4.6!!";
          I compiled using Visual Studio and copied the DLL into the Custom\Bin folder (Replacing the previous one. NT has to be closed). I then started up NT and opened the indicators dialog on a chart. The property showed up with the value. I then ran the playback and the data populated and the indicators worked with no problems!

          NOTE:
          The NinjaScript Editor won't compile the project because it's hardcoded to use 4.5.

          Comment


            #6
            Thank for sharing. It sounds like you got just one step away from accomplishing the goal. We in the Product Development and Product Management departments would love to make this change, and we started investigating it as soon as information and releases became available. However, because of the nature of the application, we simply cannot justify adopting .NET 4.6 until some of these show-stopper bugs have been fixed.

            I know as a developer you are eager to work with the latest and greatest technology, but we have to think about this as a platform-wide decision, also affecting non-NinjaScript users who simply use basic UI elements of the platform. With people's finances on the line, we cannot justify making the upgrade until we are convinced that it will not cause issues for any segment of the user base.
            Dave I.NinjaTrader Product Management

            Comment


              #7
              Thanks for the response Dave!

              I think we are talking about two different things. I'm not asking *you* to adopt .Net 4.6. No company I've ever been with has upgraded within a year of a release. To the contrary, I'm asking you to allow *users* the *option* to adopt .Net 4.6 (and future frameworks).

              The change I'm proposing does not affect NT or users who do not opt in. No different than having the option to handle rejections or overfills manually. What I proposed is to have *users* choose which compiler to use for the NinjaTrader.Custom.dll. This affects only the user who *chooses* to do this. Of course, it would come with the same caveats and warnings as the aforementioned rejection and overfill handling. NT itself would remain a .Net 4.5 application.

              P.S.

              I have come up with a solution that essentially implements what I proposed. Have had no problems so far. I will post it once I've used it for a while with no issues.

              Comment


                #8
                Originally posted by wbennettjr View Post
                I have come up with a solution that essentially implements what I proposed. Have had no problems so far. I will post it once I've used it for a while with no issues.
                That will be great - I look forward to checking it out.
                Dave I.NinjaTrader Product Management

                Comment


                  #9
                  I would like to also mention for others that may be interested in that anyone can 'opt in to 4.6' now with custom development. To do this you would create your own Visual Studio 4.6 DLL project and reference NinjaTrader DLL's same as the VS integration does now. Then you build a DLL which you then reference with NinjaTrader.

                  The con with this approach is that any DLL changes require a restart of NinjaTrader to reload since its more of a 'traditional' development cycle. I do know of one guy that added post build events to kill NinjaTrader.exe + copy over the DLL + restart NT when he built in VS to make it more seamless.

                  Comment


                    #10
                    Thanks Brett!

                    Yes, I initially ran into the whole shut down NT to replace the DLLs issue. I figured out how to get around it though. My approach allows NT to build with 4.6 so the entire process is seamless. The workflow isn't any different once everything is configured.

                    Comment


                      #11
                      I've posted the hack: http://ninjatrader.com/support/forum...ad.php?t=79605.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by LawrenHom, Today, 10:45 PM
                      0 responses
                      3 views
                      0 likes
                      Last Post LawrenHom  
                      Started by love2code2trade, Yesterday, 01:45 PM
                      4 responses
                      28 views
                      0 likes
                      Last Post love2code2trade  
                      Started by funk10101, Today, 09:43 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post funk10101  
                      Started by pkefal, 04-11-2024, 07:39 AM
                      11 responses
                      37 views
                      0 likes
                      Last Post jeronymite  
                      Started by bill2023, Yesterday, 08:51 AM
                      8 responses
                      44 views
                      0 likes
                      Last Post bill2023  
                      Working...
                      X