Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to load custom assembly: The given key was not present in the dictionary.

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

    Unable to load custom assembly: The given key was not present in the dictionary.

    Hi,

    I created a custom DLL in C#. I can use the classes in this DLL from a test bench program without problems.

    This is not a NT Addon, just a class library in C#.

    However when I add a reference for this DLL in NT8, I receive this error when I reference a member that exists in this DLL and try to compile it.

    Unable to load custom assembly: The given key was not present in the dictionary.
    Unable to retrieve type info for 'NinjaTrader.NinjaScript.AddOnBase' from assembly 'NinjaTrader.Custom': Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

    #2
    Hello jmneto,

    Thank you for the question.

    DLL loading failures can generally happen if the DLL is in the wrong format, or if one of the resources that DLL uses is not present.

    In your test program, I would suggest to open the programs output folder (usually bin/debug) and check what is in the output folder. Is it only your DLL or are there other files in the folder?

    If there are more files than just the .dll, I would suggest trying to copy all of the files into the Documents\NinjaTrader 8\bin\Custom folder, and make sure your Reference points to this folder as well.

    If the dll is in the wrong format that may also be a case, depending on the language used and format of the dll this may cause loading problems. If this is a C# dll, please ensure it is set to anycpu and .net 4.5 during the build.

    I look forward to being of further assistance.

    Comment


      #3
      Hi Jesse,

      It's c# .Net 4.5 everything is according to book. Actually the problem disappeared. Not sure it was some Visual Studio vs NT confusion or something else. Anyways, hope it keeps working.


      FYI, my observations indicate that there was some confusion when I tried to add my code as an addon but then decided to move the dll call to an indicator.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      44 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      54 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      34 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      95 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      57 views
      0 likes
      Last Post PaulMohn  
      Working...
      X