Skip to content

Commit 4773670

Browse files
Fix constructor detection on Unity.
`GetConstructors()` does not find private constructors by default, causing us to be unable to find the constructor of `ParseObject` when running in the context of Unity. Fixes #111.
1 parent 594560a commit 4773670

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Parse/Internal/ReflectionHelpers.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ internal static bool IsConstructedGenericType(this Type type) {
4747
#endif
4848
}
4949

50-
internal static IEnumerable<ConstructorInfo> GetConstructors(this Type type) {
51-
#if UNITY
52-
return type.GetConstructors();
50+
internal static IEnumerable<ConstructorInfo> GetConstructors(this Type type) {
51+
#if UNITY
52+
BindingFlags searchFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
53+
return type.GetConstructors(searchFlags);
5354
#else
5455
return type.GetTypeInfo().DeclaredConstructors
5556
.Where(c => (c.Attributes & MethodAttributes.Static) == 0);

0 commit comments

Comments
 (0)