I'm having an issue with the JsonMediaTypeFormatter
that as far as I can tell just started happening very recently.
At some point, the object I have (a plain old poco) started serializing complete as backing fields. I am using auto properties (again just a poco) but for whatever reason the output from the JsonMediaTypeFormatter
is k__backingfield<propname>:"value"
In the last weeks we have upgraded to visual studio 2015 (though I doubt that is the root cause of the problem, as this has been working for a few weeks prior).
I have cleared all forms of nuget caches, deleted all bin/obj directories.... uninstalled and reinstalled visual studio 2015 professional... repaired visual studio 2015 professional.... This code hasn't changed in some time.
We are using version 5.2.0
of System.Net.Http.Formatting
.
Thank you for any help.
Just a quick update.... this is not happening on anybody else's machine. I am not experiencing any errors (that I am noticing). I'm going to add some visual studio 2015 related tags to this as well
Ok another quick update. I have sent a LinqPad script as well as the assemblies required to run that script to a co-worker. The assemblies I am sending are the exact ones that I have pulled from nuget and compiled on my machine. When he runs the code, it serializes as desired. My machine (and now another co-worker's machine) are experiencing the issue still.
I'm continuing to isolate this as much as possible but any further guidance would be greatly appreciated
I can work around this issue by turning the JsonMediaTypeFormatter.UseDataContractJsonSerializer
property to true
. I'm doing more research as to why this works and why I would want or not want to do this... I'll have to run some more tests in the morning with co-workers who are not having this problem. I don't like the idea of a code change fixing something that is behaving unpredictably.
OK! One more update. So far the machines affected have recently installed Active Reports 10. We are performing more tests and are going to install active reports 10 on a machine that is currently not affected to see if that indeed is the culprit. Adding a tag for Active Reports. I will open a bug with them if this ends up being true.
Ok. Installing Active Reports 10 adds Newtonsoft.Json
to the GAC. Removing that assembly from the GAC has solved this problem. I will be posting a bug with active reports.