Open PaulStSmith opened 10 months ago
Not reproducible.
Please make sure that the example code you include in your report actually demonstrates the issue you are reporting. This includes verifying that the provided example code exhibits the issue when being run in dotnetfiddle or in a standalone console app (so as to make sure that everyone else can reproduce the problem with the example code given).
Also make sure that the issue occurs when using the most recent version of Newtonsoft.Json. Make sure the Newtonsoft.Json library you are using is not some 3rd-party modification but the original Newtonsoft.Json build as provided by the author of the library. (This is relevant especially for (old-ish) Unity projects, which sometimes rely on modified versions of Newtonsoft.Json. If this would be the case for your project, then the issue has to be reported not here but reported to the maintainers of that 3rd-party modification of Newtonsoft.Json instead.)
If the problem still occurs with the most recent version of Newtonsoft.Json and with the code in your report, then provide details about build setting and the environment in which you are running the code, such as but not limited to:
Debugging the serialized string it had the value "Foo" instead of the expected:
JsonConvert.SerializeObject(new Foo())
producing the string "Foo" as a result of serializing a Foo
instance should not be possible, given the code in your report. I suspect either the code in your report is not equivalent to your real code exhibiting the issue, or you have somewhere somehow configured the serializer to use some custom JsonConverter or custom ContractResolver that causes this issue. (Configuring the serializer to use custom JsonConverters or ContractResolvers can be done in several ways. To name a few examples, it could be done with the help of attribute annotations, or through the JsonConvert.DefaultSettings delegate property as far as the JsonConvert.* methods are concerned.)
Может readonly не позволяет?
At some moment in my code, I had to do a variation of this:
Then I get the following exception:
Which in turn had the following source:
Debugging the serialized string it had the value
"Foo"
instead of the expected:StackTrace for the first Exception:
StackTrace for the InnerException: