{"record":{"id":"8d969b9b5e28fc11","repo":"XINCGer/Unity3DTraining","slug":"property-propertyname-not-found-in-containingty","errorCode":null,"errorMessage":"Property {propertyName} not found in {ContainingType.ClrType}","messagePattern":"Property (.+?) not found in (.+?)","errorType":"validation","errorClass":"DescriptorValidationException","httpStatus":null,"severity":"error","filePath":"NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/FieldDescriptor.cs","lineNumber":377,"sourceCode":"            if (ContainingType != null && ContainingType.Proto.Options != null && ContainingType.Proto.Options.MessageSetWireFormat)\n            {\n                throw new DescriptorValidationException(this, \"MessageSet format is not supported.\");\n            }\n            accessor = CreateAccessor();\n        }\n\n        private IFieldAccessor CreateAccessor()\n        {\n            // If we're given no property name, that's because we really don't want an accessor.\n            // (At the moment, that means it's a map entry message...)\n            if (propertyName == null)\n            {\n                return null;\n            }\n            var property = ContainingType.ClrType.GetProperty(propertyName);\n            if (property == null)\n            {\n                throw new DescriptorValidationException(this, \"Property \" + propertyName + \" not found in \" + ContainingType.ClrType);\n            }\n            return IsMap ? new MapFieldAccessor(property, this)\n                : IsRepeated ? new RepeatedFieldAccessor(property, this)\n                : (IFieldAccessor)new SingleFieldAccessor(property, this);\n        }\n    }\n}","sourceCodeStart":359,"sourceCodeEnd":384,"githubUrl":"https://github.com/XINCGer/Unity3DTraining/blob/016f98412ea5e11756b286736f479b66ab6216d5/NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/FieldDescriptor.cs#L359-L384","documentation":"CreateAccessor links a descriptor field to the generated C# class by reflection: it looks up a property whose name is derived from the field name on ContainingType.ClrType. If the CLR type has no such property, the descriptor and the generated code are out of sync and a DescriptorValidationException is thrown.","triggerScenarios":"FileDescriptor.BuildFrom/FromGeneratedCode where the embedded descriptor contains a field whose generated property does not exist on the passed CLR type (mismatched descriptor vs assembly), or a customClrType/descriptor pair built by hand.","commonSituations":"Descriptor bytes regenerated (field added/renamed) while the old generated C# assembly is still loaded; passing the wrong message type to descriptor construction; stale plugin output after renaming a field.","solutions":["Regenerate the C# code with protoc (and the matching plugin) from the same .proto that produced the descriptor bytes.","Ensure the descriptor data and the message assembly come from the same schema version.","Verify messageDescriptor.ClrType passed during construction actually corresponds to the containing message in the descriptor.","Clean and rebuild so stale generated files are not mixed with new descriptors."],"exampleFix":"// before: stale descriptor paired with regenerated assembly\nFileDescriptor.FromGeneratedCode(oldDescriptorData, new[] { dep }, new MessageDescriptor[] { new OldMsg() });\n// after: regenerate both from the same .proto\nFileDescriptor.FromGeneratedCode(freshDescriptorData, deps, new MessageDescriptor[] { new RegeneratedMsg() });","handlingStrategy":"validation","validationCode":"bool ClrTypeMatches(MessageDescriptor md, System.Type clrType) => md.Proto.Field.All(f => clrType.GetProperty(GeneratedPropertyName(f.Name)) != null);","typeGuard":null,"tryCatchPattern":"try { FromGeneratedCode(...); } catch (ArgumentException e) when (e.InnerException is DescriptorValidationException dve && dve.Message.Contains(\"not found in\")) { log.LogError(\"Descriptor/assembly mismatch — regenerate code\"); }","preventionTips":["Regenerate C# code and descriptor bytes together in one build step.","Never mix generated files from different schema generations.","Pin protoc/plugin versions in CI."],"tags":["protobuf","reflection","deserialization","version-mismatch"],"backgroundTag":"schema-mismatch","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"}