- Ensure the DLL is for .Net Framework 4.8
- Try copying it to the relevant NinjaTrader program folder (e.g. for 64-bit: C:\Program Files (x86)\NinjaTrader 8\bin64)
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Duplicate Function Name Error when using Newtonsoft
Collapse
X
-
rezik I have not encountered that error before. Some things to investigate:
-
jeronymite I'm curious if this is the problem you ran into with the Memory issue. I added the nugent System.Memory to the custom folder and added the reference. It compiles fine, but when running the serialize from JSON I'm getting this.
Error on calling 'OnBarUpdate' method on bar 1135: Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Is this also what you encountered? Maybe I'm doing something wong.
Leave a comment:
-
For those who find the System.Text.Json approach useful, to ensure you use the latest version (rather than rely on the version provided in any NT8 distribution, given it may not always be included in NT kits), it is best to know where to obtain the dll from its source.
The dll is available through the Microsoft-supported NuGet site. If you have NuGet, you will find this straightforward. If you do not, NuGet is relatively easy to use, but even without it, you can easily obtain the dll:- The NuGet page for the System.Text.Json package: https://www.nuget.org/packages/System.Text.Json
- You can download the latest package using the "Download package" link in the right margin link list
- The filename will be similar to system.text.json.6.0.3.nupkg
- If you are familiar with NuGet, install the package
- If you do not have (or do not want to have) NuGet, use an UnZip program (e.g. 7-Zip) to open the file
- Within the file, the dll can be found in the lib folder, and then in the net461 folder (there are other folders in lib with versions that can be ignored)
- Extract the System.Text.Json.dll file to the NinjaTrader 8\bin\Custom folder (or elsewhere if you prefer) and add an appropriate reference in NT8
- You should then be able to use all the functionality in the dll
Thanks.
- Likes 2
Leave a comment:
-
Hello Bobin,
I've looked into this and found a suggested workaround.
Remove reference to Newtonsoft.dll
Exit NinjaTrader
Open the config.xml file
Add the following line under <References>
<string>netstandard.dll</string>
Save and now you should be able to compile
When exporting, select References and select the netstandard reference.
- Likes 1
Leave a comment:
-
Originally posted by jeronymite View PostI had a number of similar issues with Newtonsoft when NT 8.0.25.0 was released. Previously working code failed to compile. After a bit of testing, I was able to avoid Newtonsoft altogether and instead use System.Text.Json.dll found in the NinjaTrader Program Files bin (or bin64) folder. It also allowed me to simplify my code a little. YMMV.
Thanks.Last edited by Bobin; 04-19-2022, 09:35 AM.
Leave a comment:
-
I had a number of similar issues with Newtonsoft when NT 8.0.25.0 was released. Previously working code failed to compile. After a bit of testing, I was able to avoid Newtonsoft altogether and instead use System.Text.Json.dll found in the NinjaTrader Program Files bin (or bin64) folder. It also allowed me to simplify my code a little. YMMV.
Thanks.
- Likes 2
Leave a comment:
-
Further .. Newtonsoft might be the easiest of dll dependencies to fix. replace that earlier Newtonsoft dll with the current version 13.0xxx and then figure out how (like recompile all dependencies to NETv4.8 and update every dependent reference mention of Newtonsoft to v13.xxx ) to stop the offending dll that pulled in the wrong version of Newtonsoft today from pulling in the wrong version again every day or so....
HedgeLast edited by hedgeplay; 04-09-2022, 05:20 PM.
Leave a comment:
-
Hi Bobin..
However, I now get another error that the type "System.Object" could not be found due to a missing "netstandard" assembly.
So need to recompile / maybe rework your code for Netv48 .. or work through upgrading or replacing Dll dependencies with those compiled for Netv48 rather than NetStandard.
As an example.. I am running with dlls with dependencies on other dlls I had to recompile with NETv4.8 or replace those dependent dlls with alternatives.
Hedge.
Leave a comment:
-
I tried to reference the Newtonsoft dll in the bin64 folder. The initial error is now gone.
However, I now get another error that the type "System.Object" could not be found due to a missing "netstandard" assembly.
This is very odd, because the dll is used by NinjaTrader itself, right?
Leave a comment:
-
Duplicate Function Name Error when using Newtonsoft
I use Newtonsoft in my project for json's.
It works fine, but when I export my project to an Add-On and try to import it on another PC, then I get an error that there is a duplicate function name.
After I remove Newtonsoft and export/import the project again, then I don't get an error.
How can I fix it?Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by GLFX005, Today, 03:23 AM
|
0 responses
1 view
0 likes
|
Last Post
by GLFX005
Today, 03:23 AM
|
||
Started by XXtrader, Yesterday, 11:30 PM
|
2 responses
11 views
0 likes
|
Last Post
by XXtrader
Today, 03:07 AM
|
||
Started by Waxavi, Today, 02:10 AM
|
0 responses
6 views
0 likes
|
Last Post
by Waxavi
Today, 02:10 AM
|
||
Started by TradeForge, Today, 02:09 AM
|
0 responses
12 views
0 likes
|
Last Post
by TradeForge
Today, 02:09 AM
|
||
Started by Waxavi, Today, 02:00 AM
|
0 responses
2 views
0 likes
|
Last Post
by Waxavi
Today, 02:00 AM
|
Leave a comment: