{"record":{"id":"2dfeb37c546ca116","repo":"XINCGer/Unity3DTraining","slug":"invalid-field-type","errorCode":null,"errorMessage":"Invalid field type","messagePattern":"Invalid field type","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/JsonFormatter.cs","lineNumber":329,"sourceCode":"                case FieldType.Enum:\n                    return (int)value == 0;\n                case FieldType.Fixed32:\n                case FieldType.UInt32:\n                    return (uint)value == 0;\n                case FieldType.Fixed64:\n                case FieldType.UInt64:\n                    return (ulong)value == 0;\n                case FieldType.SFixed64:\n                case FieldType.Int64:\n                case FieldType.SInt64:\n                    return (long)value == 0;\n                case FieldType.Float:\n                    return (float)value == 0f;\n                case FieldType.Message:\n                case FieldType.Group: // Never expect to get this, but...\n                    return value == null;\n                default:\n                    throw new ArgumentException(\"Invalid field type\");\n            }\n        }\n\n        /// <summary>\n        /// Writes a single value to the given writer as JSON. Only types understood by\n        /// Protocol Buffers can be written in this way. This method is only exposed for\n        /// advanced use cases; most users should be using <see cref=\"Format(IMessage)\"/>\n        /// or <see cref=\"Format(IMessage, TextWriter)\"/>.\n        /// </summary>\n        /// <param name=\"writer\">The writer to write the value to. Must not be null.</param>\n        /// <param name=\"value\">The value to write. May be null.</param>\n        public void WriteValue(TextWriter writer, object value)\n        {\n            if (value == null)\n            {\n                WriteNull(writer);\n            }\n            else if (value is bool)","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/XINCGer/Unity3DTraining/blob/016f98412ea5e11756b286736f479b66ab6216d5/NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/JsonFormatter.cs#L311-L347","documentation":"JsonFormatter.IsDefaultValue throws ArgumentException when a field's FieldType is not one of the supported scalar/message types. This is an internal exhaustiveness guard: the formatter only knows how to compute default values for known FieldTypes.","triggerScenarios":"Calling JsonFormatter.Format on a message whose descriptor contains a field with an unrecognized FieldType, typically from a descriptor loaded dynamically or a runtime/generated-code version mismatch.","commonSituations":"Mixing generated code with an older/newer Google.Protobuf runtime; hand-built descriptors with unusual field types; formatting groups/messages loaded via reflection from foreign descriptor sets.","solutions":["Regenerate C# code with a protoc version matching the Google.Protobuf runtime package","Verify all field types in the message descriptor are standard protobuf types","Avoid hand-modified or synthesized descriptors","Upgrade the Google.Protobuf NuGet package so the FieldType enum matches"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { json = formatter.Format(msg); } catch (ArgumentException ex) { /* log descriptor/type mismatch; regenerate code */ }","preventionTips":["Keep protoc-generated code and Google.Protobuf package versions compatible","Never hand-edit descriptors","Format only messages produced by generated code"],"tags":["csharp","protobuf","json"],"backgroundTag":"internal-invariant-violation","analyzedSha":"016f98412ea5e11756b286736f479b66ab6216d5","analyzedAt":"2026-09-12T01:08:58.711Z","contentChangedAt":"2026-09-12T01:08:58.711Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}