Hi,
we are working on porting our apps from MG 2.5 to MG 3.2 (via sources). We are facing an issue with the MGCB tool. We noticed that the tool fails to create .xnb from our xml which defines a custom object type. The issue is related to the fact that the xml represents a class which contains some “internal” access properties.
Should this code:
public static PropertyInfo[] GetAllProperties(this Type type)
{
// Sometimes, overridden properties of abstract classes can show up even with
// BindingFlags.DeclaredOnly is passed to GetProperties. Make sure that
// all properties in this list are defined in this class by comparing
// its get method with that of it's base class. If they're the same
// Then it's an overridden property.
#if WINRT
PropertyInfo[] infos= type.GetTypeInfo().DeclaredProperties.ToArray();
var nonStaticPropertyInfos = from p in infos
where (p.GetMethod != null) && (!p.GetMethod.IsStatic) &&
(p.GetMethod == p.GetMethod.GetRuntimeBaseDefinition())
select p;
return nonStaticPropertyInfos.ToArray();
#else
var attrs = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly;
var allProps = type.GetProperties(attrs).ToList();
var props = allProps.FindAll(p => p.GetGetMethod() != null && p.GetGetMethod() == p.GetGetMethod().GetBaseDefinition()).ToArray();
return props;
#endif
}
fixed using:
var props = allProps.FindAll(p => p.GetGetMethod(true) != null && p.GetGetMethod(true) == p.GetGetMethod(true).GetBaseDefinition()).ToArray();