Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Upgrading Custom Assembles to .Net 8/9

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

    Upgrading Custom Assembles to .Net 8/9

    NinjaTrader has recently upgraded to using C# 9. I proceeded to upgrade and rebuild my custom assemblies but in doing so they no longer load.

    I took a clean copy of NinjaTrader and my simplest assembly containing one class that has no references to any NinjaTrader types. With the target framework set to net48 it loads as expected but when set to net8.0, net9.0, net8.0-windows or net9.0 windows I get the following error.

    Unable to retrieve type info for 'NinjaTrader.NinjaScript.AddOnBase' from assembly...

    The latest release notes for 8.1.4 include "The NinjaScript Editor has been updated to support C# 9"

    Does this mean that NinjaTrader supportes C# version 9 the language, but not .net 9? When building custom assemblies, does it need to target net48?


    #2
    Yep - C#, the language syntax. Totally different from the framework, which is still 4.8 - You'll never see .net 9, lol

    Comment


      #3
      Hello ntbone,

      NinjaTrader currently uses C# 9 however that won't require you to update anything in your code, your existing code will work. Changing the target framework in visual studio will cause problems so you would not want to do that specifically. When you install NinjaTrader the NinjaTrader.Custom project already targets the correct framework and should not be modified. Keep in mind C# version is not the same as .net version. NinjaTrader uses C# language version 9, .net framework version 4.8
      JesseNinjaTrader Customer Service

      Comment


        #4
        Within the .NET universe, Microsoft has muddied the waters a bit.

        '.NET 4.8' is shorthand way of saying 'version 4.8 of the .NET Framework'.

        The others, such as '.NET 8', are usually just versions of the much
        newer '.NET Core' libraries.

        '.NET Framework' and '.NET Core' are two completely different things.

        NinjaTrader has always used .NET Framework, since it came first, ya
        know, like, almost 25 years ago when .NET itself first came out.

        .NET Core represents an attempt to modernize and make a more
        portable set of class libraries, but they are wildly incompatible with
        the older .NET Framework libraries.

        Seeing NinjaTrader port their codebase to .NET Core would be an
        amazing accomplishment, but I suspect that may never happen.

        'Porting code' can be extremely non-trivial if it really means an almost
        total rewrite, which is probably what the NT engs would have to do.

        But, we can always hope NT9 is secretly in progress and represents
        a rewrite using the new .NET Core libraries -- since .NET Framework
        has been considered legacy and obsolete for quite some time, there
        is no future left in that direction.

        -=o=-

        And, yes, the C# language has a version number that has absolutely
        nothing to do with any of the version numbering you see in any of
        the .NET version numbers in any of the various .NET class libraries
        in any .NET world in any .NET universe you've ever been a part of.

        If the numbers happen to be the same, that's just a coincidence.



        EDIT: A extended note about the muddy waters: Microsoft is trying
        to rebrand/recast the phrasing '.NET Core' as simply '.NET' -- which
        potentially adds more confusion to new comers unaware of the naming
        hell that preceded this consolidated name approach. This kinda does
        work, though, because .NET Framework is obsolete and .NET Core
        (since it's cross-platform) is the only direction for the future.
        Last edited by bltdavid; 02-19-2025, 09:59 AM. Reason: Add note on current naming hell landscape, typos

        Comment


          #5
          Originally posted by ntbone View Post
          The latest release notes for 8.1.4 include "The NinjaScript Editor has been updated to support C# 9"

          Does this mean that NinjaTrader supportes C# version 9 the language, but not .net 9?
          Correct.

          Originally posted by ntbone View Post
          ​When building custom assemblies, does it need to target net48?
          Yes.

          Comment


            #6
            For those looking to use the latest language version in their external assemblies you set
            Code:
            <TargetFramework>net48</TargetFramework>
            <LangVersion>9.0</LangVersion>
            This will allow you to use the latest language features. This is for the new SDK style project. If you do not set a language version, Visual Studio will default to 7.3.

            In hindsight it makes sense that NinjaTrader hasn't switched to .net8/9. Those frameworks do support WPF and WPF apps can typically be ported over but there .Net API's that are going to be different and it would break the addon eco system for all addon's that are external assemblies. They would all need to be rebuilt and republished.

            Comment


              #7
              Originally posted by NinjaTrader_Jesse View Post
              Hello ntbone,

              NinjaTrader currently uses C# 9 however that won't require you to update anything in your code, your existing code will work. Changing the target framework in visual studio will cause problems so you would not want to do that specifically. When you install NinjaTrader the NinjaTrader.Custom project already targets the correct framework and should not be modified. Keep in mind C# version is not the same as .net version. NinjaTrader uses C# language version 9, .net framework version 4.8
              I was referring to assemblies that are external to NinjaTrader that are then added as references (or by other means). I was not referring to any changes to the NinjaTrader.Custom project.

              Comment


                #8
                Originally posted by ntbone View Post
                In hindsight it makes sense that NinjaTrader hasn't switched to .net8/9. Those frameworks do support WPF and WPF apps can typically be ported over but there .Net API's that are going to be different and it would break the addon eco system for all addon's that are external assemblies. They would all need to be rebuilt and republished.
                Moving away from .NET Framework to .NET Core would surely
                happen only on a future major new release, like NT9 or NT10.

                And, absolutely, I'd thoroughly expect the .NET Core version of
                NT9/10 to break absolutely everything before it -- just like NT8
                broke everything before it.

                C'est la vie.



                Comment


                  #9
                  Personally, I think we won't see NT9 anytime soon, at least not the PC version. We live in the mobile/web era, sadly, and most efforts will be focused there.​

                  Comment


                    #10
                    Interesting thread. From the user POV, I avoid assemblies made by others, including commercial, because of perceived lack of security/inability to control what assembly can do. Am I wrong about that?

                    Comment


                      #11
                      Originally posted by MiCe1999 View Post
                      Interesting thread. From the user POV, I avoid assemblies made by others, including commercial, because of perceived lack of security/inability to control what assembly can do. Am I wrong about that?
                      Unless you can be much more specific with your concerns,
                      I would say, yes, you are generally uninformed, and, uh,
                      quite wrong.

                      Have you any experiences that made you feel this way?

                      What happened?

                      Come, sit down on the couch ...

                      Comment


                        #12
                        Originally posted by bltdavid View Post

                        Unless you can be much more specific with your concerns,
                        I would say, yes, you are generally uninformed, and, uh,
                        quite wrong.

                        Have you any experiences that made you feel this way?

                        What happened?

                        Come, sit down on the couch ...

                        My impression is that custom assembly can do anything that ninjatrader process can, including connecting to any internet hosts. Is that not correct?

                        Comment


                          #13
                          Originally posted by MiCe1999 View Post
                          My impression is that custom assembly can do anything that ninjatrader process can, including connecting to any internet hosts. Is that not correct?
                          Correct.

                          Realize most commercial assemblies will connect to some
                          internet host somewhere to verify your license with them.

                          Otherwise, as far as nefarious intentions from your commercial
                          assembly, that's more paranoia than reality.

                          Reputable vendors simply don't do that.

                          Comment


                            #14
                            Originally posted by bltdavid View Post

                            Correct.

                            Realize most commercial assemblies will connect to some
                            internet host somewhere to verify your license with them.

                            Otherwise, as far as nefarious intentions from your commercial
                            assembly, that's more paranoia than reality.

                            Reputable vendors simply don't do that.
                            Rhetorical question: how one figures who is reputable? That's the issue that NT should look more into as it affects third party business, IMO. One bad apple can spoil the whole platform. On the other hand, my distrust pushed me to learn C# and I love the NT platform, thanks in big part to AI.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by algospoke, 03-12-2025, 07:41 PM
                            4 responses
                            43 views
                            0 likes
                            Last Post algospoke  
                            Started by clarocque1, Today, 06:18 PM
                            0 responses
                            5 views
                            0 likes
                            Last Post clarocque1  
                            Started by clarocque1, Today, 06:17 PM
                            0 responses
                            4 views
                            0 likes
                            Last Post clarocque1  
                            Started by clarocque1, 03-23-2025, 08:17 AM
                            4 responses
                            28 views
                            0 likes
                            Last Post clarocque1  
                            Started by Artorias, Today, 05:22 PM
                            0 responses
                            9 views
                            0 likes
                            Last Post Artorias  
                            Working...
                            X