From 47736705bf2811dc32813460ed98aef0313c2395 Mon Sep 17 00:00:00 2001 From: Richard Ross Date: Mon, 7 Dec 2015 14:07:11 -0800 Subject: [PATCH] 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. --- Parse/Internal/ReflectionHelpers.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Parse/Internal/ReflectionHelpers.cs b/Parse/Internal/ReflectionHelpers.cs index 32ca57c9..6d99ccf5 100644 --- a/Parse/Internal/ReflectionHelpers.cs +++ b/Parse/Internal/ReflectionHelpers.cs @@ -47,9 +47,10 @@ internal static bool IsConstructedGenericType(this Type type) { #endif } - internal static IEnumerable GetConstructors(this Type type) { -#if UNITY - return type.GetConstructors(); + internal static IEnumerable GetConstructors(this Type type) { +#if UNITY + BindingFlags searchFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; + return type.GetConstructors(searchFlags); #else return type.GetTypeInfo().DeclaredConstructors .Where(c => (c.Attributes & MethodAttributes.Static) == 0);