{"record":{"id":"e01085eba5c54789","repo":"XINCGer/Unity3DTraining","slug":"missing-name","errorCode":null,"errorMessage":"Missing name.","messagePattern":"Missing name\\.","errorType":"validation","errorClass":"DescriptorValidationException","httpStatus":null,"severity":"error","filePath":"NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/DescriptorPool.cs","lineNumber":196,"sourceCode":"                }\n                throw new DescriptorValidationException(descriptor, message);\n            }\n            descriptorsByName[fullName] = descriptor;\n        }\n\n        private static readonly Regex ValidationRegex = new Regex(\"^[_A-Za-z][_A-Za-z0-9]*$\",\n                                                                  FrameworkPortability.CompiledRegexWhereAvailable);\n\n        /// <summary>\n        /// Verifies that the descriptor's name is valid (i.e. it contains\n        /// only letters, digits and underscores, and does not start with a digit).\n        /// </summary>\n        /// <param name=\"descriptor\"></param>\n        private static void ValidateSymbolName(IDescriptor descriptor)\n        {\n            if (descriptor.Name == \"\")\n            {\n                throw new DescriptorValidationException(descriptor, \"Missing name.\");\n            }\n            if (!ValidationRegex.IsMatch(descriptor.Name))\n            {\n                throw new DescriptorValidationException(descriptor,\n                                                        \"\\\"\" + descriptor.Name + \"\\\" is not a valid identifier.\");\n            }\n        }\n\n        /// <summary>\n        /// Returns the field with the given number in the given descriptor,\n        /// or null if it can't be found.\n        /// </summary>\n        internal FieldDescriptor FindFieldByNumber(MessageDescriptor messageDescriptor, int number)\n        {\n            FieldDescriptor ret;\n            fieldsByNumber.TryGetValue(new DescriptorIntPair(messageDescriptor, number), out ret);\n            return ret;\n        }","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/XINCGer/Unity3DTraining/blob/016f98412ea5e11756b286736f479b66ab6216d5/NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/DescriptorPool.cs#L178-L214","documentation":"DescriptorPool.ValidateSymbolName throws DescriptorValidationException when a descriptor being registered (message, field, enum, etc.) has an empty Name. Every proto declaration must have a non-empty identifier name, so an empty name is rejected during descriptor construction.","triggerScenarios":"Constructing descriptors (directly via DescriptorProtos or via FileDescriptor.BuildFromByteString) where a FieldDescriptorProto/DescriptorProto/EnumDescriptorProto has an unset or empty 'name' — typically a hand-constructed DescriptorProto or a corrupted/missing 'name' field in a serialized FileDescriptorSet.","commonSituations":"Programmatically building FileDescriptorProto/DescriptorProto and forgetting to set Name before building; a descriptor set produced by a broken codegen or tooling pipeline dropping name fields; manual edits to serialized descriptors.","solutions":["Set the Name property on every proto descriptor before building (e.g. new DescriptorProto { Name = \"MyMessage\" }).","Inspect the serialized FileDescriptorSet (protoc --descriptor_set_out) for declarations missing name fields.","Regenerate descriptors with protoc rather than hand-crafting or editing serialized descriptor bytes.","Add a pre-build check that iterates your FileDescriptorProto tree and asserts every declaration has a non-empty Name."],"exampleFix":"// before\nvar msg = new DescriptorProto(); // Name unset -> \"Missing name.\"\nfileProto.MessageTypes.Add(msg);\n// after\nvar msg = new DescriptorProto { Name = \"MyMessage\" };\nfileProto.MessageTypes.Add(msg);","handlingStrategy":"validation","validationCode":"static void AssertNamesSet(FileDescriptorProto file)\n{\n    foreach (var m in file.MessageTypes)\n        if (string.IsNullOrEmpty(m.Name)) throw new InvalidOperationException(\"Descriptor missing name\");\n}","typeGuard":"bool HasName(IDescriptor d) => !string.IsNullOrEmpty(d.Name);","tryCatchPattern":"try\n{\n    var fd = FileDescriptor.BuildFromByteString(bytes, dependencies);\n}\ncatch (DescriptorValidationException ex) when (ex.Message == \"Missing name.\")\n{\n    // reject/deserialize the descriptor set at source\n}","preventionTips":["Always set Name in object initializers when constructing DescriptorProtos","Regenerate descriptors with protoc instead of hand-editing serialized bytes","Assert every declaration has a name before BuildFromByteString"],"tags":["protobuf","descriptor","validation","csharp"],"backgroundTag":"empty-required-field","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"}