Similar to this question, which was marked as a duplicate (so I couldn't answer it directly).
I have a webapi project, which references a PCL project. I was getting this DefaultContractResolver error intermittently.
I had tried all of the troubleshooting steps from that other question, largely involving uninstalling and reinstalling the nuget packages. Didn't help.
Two other things that may help:
The root cause of the problem for me was that both my webapi project and my PCL project were referencing Newtonsoft.Json.dll. There seemed to be some kind of race condition in Visual Studio build, so that if the PCL project was built last, it would copy its portable version of Newtonsoft.Json.dll into my webapi project's \bin directory.
The solution was simply to go into my PCL project's References, and turn off "Copy local" for Newtonsoft.Json.dll
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With