The nuget package requirements is Newtonsoft.Json (>= 9.0.1)
but latest Sendgrid 9.4.1 does not work with Newtonsoft.Json.10.0.2
You will get an exception saying that it can't load Newtonsoft.Json 9.0.0
VS 2015
Install via Nu-get
.NET Version: 4.5.2
Duplicate of #441
Thanks for the additional report, I appreciate the details :)
Please do follow issue #441 for updates and I've added both your votes to the issue.
A quick test shows that sendgrid v9 works with json.net v10. It just requires a binding redirect, which NuGet should have added automatically. Check your app.config or web.config and make sure you have the following entry in it and if you don't add it and try again. If you don't have a config you'll need to add one.
diff --git a/src/Website/Web.config b/src/Website/Web.config
index ebef20b..30ef992 100644
--- a/src/Website/Web.config
+++ b/src/Website/Web.config
@@ -128,7 +128,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
+ <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
In my case bindingRedirect is present but does't resolve the issue
I can compile but then it throws and exception saying that it needs 9.0.0
I understand that the fix must work but it doesnt , any ideas why?
I dont remember exactly ... but should bindingRedirect work not only for immediate dependencies but also for dependencies of dependencies?
Ok, I've resolved by compiling from sources with updated Newtonsoft.Json package
I dont remember exactly ... but should bindingRedirect work not only for immediate dependencies but also for dependencies of dependencies?
They should, that's how my setup is. The site is referencing Sendgrid v9.4.1 and Json.NET v10.0.2 and it's working correctly sending email with the same code in #441.
Then that's very strange...but as I said above your fix doesnt work for me
@mightywill I am in the same situation as you. There is .net 4.5.2 depency linked to Newtonsoft so I will likely have to duplicate your approach. To be sure you:
@smartnotify AFAIR, there was a fix for this issue made by dev team but I did not test it
In my case I've just taken the latest Sendgrid code and updated refs to use the latest Newtonsoft.Json (using some NuGet function, dont remember which exactly, but it was very straightforward)
and then compiled it and used it
so yes, your steps look correct
Most helpful comment
@smartnotify AFAIR, there was a fix for this issue made by dev team but I did not test it
In my case I've just taken the latest Sendgrid code and updated refs to use the latest Newtonsoft.Json (using some NuGet function, dont remember which exactly, but it was very straightforward)
and then compiled it and used it
so yes, your steps look correct