diff --git a/C#-and-.NET-docs-supplement.md b/C#-and-.NET-docs-supplement.md index 920c386..2d2c825 100644 --- a/C#-and-.NET-docs-supplement.md +++ b/C#-and-.NET-docs-supplement.md @@ -38,6 +38,12 @@ On (older versions of?) VS, `Condition` is ignored if placed on a property/item. When ``ing a `.props` file, `ProjectDir` is unset (but `SolutionDir` *is* set, if applicable). Use `MSBuildProjectDirectory`. Note that the latter doesn't include a trailing slash. +## `Newtonsoft.Json` footguns + +`byte[]` is [*intentionally hardcoded*](https://github.com/JamesNK/Newtonsoft.Json/issues/1869#issuecomment-429588794) to serialise to a base64 string (as opposed to a list, like `short[]`, `int[]`, etc. are). The only workaround is to implement `JsonConverter` ([already done](https://github.com/TASEmulators/BizHawk/blob/484e1fee7805c3b54b606290a4dd45ad842df4d2/src/BizHawk.Emulation.Common/U8ArrayAsNormalJSONListConverter.cs#L23)), then either [mark the field/prop](https://github.com/TASEmulators/BizHawk/blob/484e1fee7805c3b54b606290a4dd45ad842df4d2/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.ISettable.cs#L65), or pass [this](https://github.com/TASEmulators/BizHawk/blob/484e1fee7805c3b54b606290a4dd45ad842df4d2/src/BizHawk.Emulation.Common/U8ArrayAsNormalJSONListConverter.cs#L12) in the serialiser settings. (This behaviour [also made it into `System.Text.Json`](https://github.com/dotnet/runtime/issues/89024#issuecomment-1638489257).) + +If a string literal contains a date, *even if it's being deserialised to a string*, it will first be [deserialised to a date, timezone-corrected, and re-serialised](https://github.com/JamesNK/Newtonsoft.Json/issues/862). + ## NuGet resources are all for old CLI [up-to-date docs on MSDN](https://learn.microsoft.com/en-us/nuget/consume-packages/install-use-packages-dotnet-cli)