Skip to content

Commit

Permalink
added hotfix to serialize base classes
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftkey committed Mar 5, 2014
1 parent 5a6df4a commit f9f2c81
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Octokit/SimpleJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,17 @@ public static ConstructorInfo GetConstructorInfo(Type type, params Type[] argsTy
public static IEnumerable<PropertyInfo> GetProperties(Type type)
{
#if SIMPLE_JSON_TYPEINFO
return type.GetTypeInfo().DeclaredProperties;
var typeInfo = type.GetTypeInfo();
var properties = typeInfo.DeclaredProperties;

if (typeInfo.BaseType == null)
return properties;

if (typeInfo.BaseType.FullName == typeof (Object).FullName)
return properties;

var baseProperties = GetProperties(typeInfo.BaseType);
return System.Linq.Enumerable.Concat(properties, baseProperties);
#else
return type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
#endif
Expand Down

1 comment on commit f9f2c81

@shiftkey
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix has been submitted upstream: facebook-csharp-sdk/simple-json#49

Please sign in to comment.