diff --git a/src/Discord.Net.Serialization/Serializer.cs b/src/Discord.Net.Serialization/Serializer.cs index b58354103..acac27bb9 100644 --- a/src/Discord.Net.Serialization/Serializer.cs +++ b/src/Discord.Net.Serialization/Serializer.cs @@ -56,18 +56,23 @@ namespace Discord.Serialization return _maps.GetOrAdd(typeof(TModel), _ => { var type = typeof(TModel).GetTypeInfo(); - var propInfos = type.DeclaredProperties - .Where(x => x.CanRead && x.CanWrite) - .ToArray(); - var properties = new List(); - for (int i = 0; i < propInfos.Length; i++) + while (type != null) { - if (propInfos[i].GetCustomAttribute() != null) + var propInfos = type.DeclaredProperties + .Where(x => x.CanRead && x.CanWrite) + .ToArray(); + + for (int i = 0; i < propInfos.Length; i++) { - var propMap = MapProperty(propInfos[i]); - properties.Add(propMap); + if (propInfos[i].GetCustomAttribute() != null) + { + var propMap = MapProperty(propInfos[i]); + properties.Add(propMap); + } } + + type = type.BaseType?.GetTypeInfo(); } return new ModelMap(this, type, properties); }) as ModelMap;