Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to retrieve type info for assembly 'Npgsql':

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

    Unable to retrieve type info for assembly 'Npgsql':

    When I start up NT now, I get an error dialog that says:

    Unable to retrieve type info for assembly 'Npgsql': Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

    The order of events:

    I wanted to use Visual Studio with NT8. There is no .sln file in NT8 [anymore] so I imported the .csproj file instead. Knowing it would overwrite things, I saved all the NinjaTrader.Custom.* files first.

    when I tried "attach to process", it failed. I found an article called

    "8.1.3.0 crashes on Attach to Process in Visual Studio 2022"

    I'm not going to uninstall all my indicators, etc, so that means I'm going to skip using VS until that is fixe [if ever].

    Then, in NT, I wanted to use Volumetric bars, and when I tried, I got this:

    Click image for larger version

Name:	image.png
Views:	235
Size:	4.3 KB
ID:	1328933

    I asked my associate and he said I need a different license.

    But then today, when I opened NT, I was getting an error. I thought it was related to the volumetric bars, but that chart wasn't even open anymore. But I'm not sure of the exact text of the message.

    Then I got an email from Replikanto saying that v8.1.4.1 was available to fix bugs from 8.1.4.0. NT doesn't seem to have any automated way to install updates, so I downloaded it and installed.

    Once that was done, I could start up the program, but when I tried to apply my Strategy, it crashed, with this error:

    Strategy 'MyStrategy': Error on calling 'OnBarUpdate' method on bar 6615602: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
    Disabling NinjaScript strategy 'MyStrategy/332258875'


    MyStrategy ​uses npgsql.dll and was working fine before.

    I asked ChatGPT how to fix it and it said I needed to update/change my npgsql.dll file, though I'm not sure why unless it's a change caused by new NT8 version...
    I downloaded several different versions from netstandard2.0 and net461 folders of the npgsql packages, but none of them changed anything.

    Then I read this article:

    "After installing new version getting error msg: Unable to retrieve info for ..."

    ...and tried putting back the old NinjaTrader.Custom.* files. That didn't help. I tried deleting them, and letting it re-create them. That didn't help.

    Then I ran out of ideas to try.

    #2
    Hello DerkWehler,

    Assemblies obfuscated with Agile 6.6.0.35 will cause a crash when attaching the debugger process to NinjaTrader.

    Unfortunately, from my understanding there is not way to correct this. It will be necessary to obtain new assemblies exported with NinjaTrader 8.1.4.1 and Agile 6.9.1.2.
    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


    Order Flow+ can be added to your user account in the Account Portal.


    Any dlls referenced will need to target .NET 4.8.

    NinjaTrader does include a 'System.Threading.Tasks.Extensions.dll' you can reference in the Program Files\NinjaTrader 8\bin directory.

    Unfortunately, our support is not able to provide direction on using external dll assemblies, we are only able to provide direction on how to add a reference.


    Regarding netstandard, if the goal is to use JSON, this may be possible referencing the Newtonsoft.JSON.dll in the Program Files\NinjaTrader 8\bin directory.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3


      Just takes me to a login page, even if I'm already logged in.

      Re: System.Threading.Tasks.Extensions.dll
      It is not in my installation. I had to get it from Nuget download site; I downloaded system.threading.tasks.extensions.4.6.0.nuspec (zip file). In their lib folder there is a version of System.Threading.Tasks.Extensions.dll in a net462 folder and a netstandard2.0 folder.

      Do you know which of those (if either) I should copy to the .\bin\custom folder?

      Comment


        #4
        Hello DerkWehler,

        Are you certain you are looking in the Program Files\NinjaTrader 8\bin folder?

        I just made a fresh install to double check and its there.
        Click image for larger version

Name:	Screenshot 2024-12-23 115747.png
Views:	149
Size:	94.6 KB
ID:	1329004

        I am not able to direct you on whether you should use the nuget packages. This would be up to you.
        I can direct you on how to add a reference to them should you choose to use them.
        If there are issues, I would not be able to assist.

        I am suggesting using the System.Threading.Tasks.Extensions.dll and the Newtonsoft.JSON.dll installed with NinjaTrader from the program files directory.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          The only thing in the bin folder is the custom folder. There is a Newtonsoft.Json.dll, but the last file (alphabetically) is RestSharp.dll

          I can try another install of 8.1.4.1, just renaming the current folder first...

          Comment


            #6
            Hello DerkWehler,

            Are you certain you are not looking in Documents\NinjaTrader 8\bin and that you are looking in Program Files\NinjaTrader 8\bin?

            May I have a screenshot of the Window Explorer window?

            RestSharp.dll is not installed with NinjaTrader and should not be in this folder. If it's in there it was manually placed there and should be removed and moved to Documents\NinjaTrader 8\bin\Custom.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              My apologies; I completely glossed over that you were looking in the ProgramFiles' NT8\bin.

              Yes, I have the file there. Is that sufficient, or do I need to copy it to docs\NT8\bin\custom?


              Comment


                #8
                Hello DerkWehler,

                You should not copy the file. Just add a reference.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_ChelseaB View Post
                  Hello DerkWehler,

                  You should not copy the file. Just add a reference.
                  From the NS Editor?

                  Comment


                    #10
                    Hello DerkWehler,

                    Yes, references are added in the NinjaScript Editor. Right-click within the editor pane and select References. Navigate to Program Files\NinjaTrader 8\bin and select the file. Click OK.
                    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Thank you very much for your replies...

                      I did that; it was not there, so I added it. Then I recompiled and tried to run it. Still got:

                      Error on calling 'OnBarUpdate' method on bar 7000254: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
                      Disabling NinjaScript strategy 'MyStrategy/332258875'

                      And I still get this error when I start up NT8:

                      Click image for larger version

Name:	image.png
Views:	142
Size:	6.4 KB
ID:	1329017

                      Then usually it terminate NT8, but if I restart, it puts up the same error, but then starts the program.

                      Comment


                        #12
                        Hello DerkWehler,

                        Are there multiple references to this library?

                        Is MyStrategy an open source script or is this an assembly?

                        Is there a using statement for System.Threading.Tasks.Extensions?

                        What lines of code are using this library?

                        With the Npgsql I am not able to provide further assistance. I would recommend confirming this assembly was compiled targeting .NET 4.8.

                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by DerkWehler View Post
                          Thank you very much for your replies...

                          I did that; it was not there, so I added it. Then I recompiled and tried to run it. Still got:

                          Error on calling 'OnBarUpdate' method on bar 7000254: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
                          Disabling NinjaScript strategy 'MyStrategy/332258875'

                          And I still get this error when I start up NT8:

                          Click image for larger version  Name:	image.png Views:	0 Size:	6.4 KB ID:	1329017

                          Then usually it terminate NT8, but if I restart, it puts up the same error, but then starts the program.
                          I wrote it. There is [only] this:
                          using System.Threading.Tasks;

                          Honestly, I am not sure why it is there. All the things I had to manually add, I commented, like these:
                          using Newtonsoft.Json; /// Added for automatic parsing of http response
                          using Npgsql; /// Added for new signal get method Sep2024

                          The whole strategy used to work last week (no code changes), before my messing with VS and [installing] NT 8.1.4.1

                          And as I mentioned, I gave up on VS, and am just [still] using NS Code Editor.

                          Comment


                            #14
                            Originally posted by NinjaTrader_ChelseaB View Post
                            Hello DerkWehler,

                            Are there multiple references to this library?

                            Is MyStrategy an open source script or is this an assembly?

                            Is there a using statement for System.Threading.Tasks.Extensions?

                            What lines of code are using this library?

                            With the Npgsql I am not able to provide further assistance. I would recommend confirming this assembly was compiled targeting .NET 4.8.
                            Hello,
                            Hope you are having a good holiday season.
                            I am still getting the crash/error about System.Threading.Tasks.Extensions, though I have not seen the error lately about Npgsql.
                            Is there something about moving to 8.1.4.1 that might be causing this "Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.2.0.0"?
                            I tried re-adding the reference to it from \ProgramFiles\bin\

                            Comment


                              #15
                              Hello DerkWehler,

                              What lines of code are using this library?

                              If you remove the using statement and the reference is the script able to compile and run?
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              57 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              37 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              18 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              20 views
                              0 likes
                              Last Post TheRealMorford  
                              Started by Mindset, 02-28-2026, 06:16 AM
                              0 responses
                              49 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Working...
                              X