aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/Google.Protobuf/JsonFormatter.cs
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2015-11-23 16:21:47 +0000
committerJon Skeet <jonskeet@google.com>2015-12-02 07:54:34 +0000
commit3de2fced6be1cc5e8f321c5aee2bb43176be962a (patch)
tree2942a336c3eb43c792520bbfd75006f2b2f4c6a6 /csharp/src/Google.Protobuf/JsonFormatter.cs
parent567579b50517e4f7efc459ab1d9d5ee2577af024 (diff)
downloadprotobuf-3de2fced6be1cc5e8f321c5aee2bb43176be962a.tar.gz
protobuf-3de2fced6be1cc5e8f321c5aee2bb43176be962a.tar.bz2
protobuf-3de2fced6be1cc5e8f321c5aee2bb43176be962a.zip
Handle JSON parsing for Any.
This required a rework of the tokenizer to allow for a "replaying" tokenizer, basically in case the @type value comes after the data itself. This rework is nice in some ways (all the pushback and object depth logic in one place) but is a little fragile in terms of token push-back when using the replay tokenizer. It'll be fine for the scenario we need it for, but we should be careful...
Diffstat (limited to 'csharp/src/Google.Protobuf/JsonFormatter.cs')
-rw-r--r--csharp/src/Google.Protobuf/JsonFormatter.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/csharp/src/Google.Protobuf/JsonFormatter.cs b/csharp/src/Google.Protobuf/JsonFormatter.cs
index c7d392cd..45941b39 100644
--- a/csharp/src/Google.Protobuf/JsonFormatter.cs
+++ b/csharp/src/Google.Protobuf/JsonFormatter.cs
@@ -808,12 +808,17 @@ namespace Google.Protobuf
/// </summary>
public sealed class Settings
{
- private static readonly Settings defaultInstance = new Settings(false);
-
/// <summary>
/// Default settings, as used by <see cref="JsonFormatter.Default"/>
/// </summary>
- public static Settings Default { get; } = new Settings(false);
+ public static Settings Default { get; }
+
+ // Workaround for the Mono compiler complaining about XML comments not being on
+ // valid language elements.
+ static Settings()
+ {
+ Default = new Settings(false);
+ }
/// <summary>
/// Whether fields whose values are the default for the field type (e.g. 0 for integers)