Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 4391752

Browse files
committed
Fix PCL builds
1 parent cb55ad5 commit 4391752

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/ServiceStack.Text/CsvReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ internal static void Reset()
118118
var isDataContract = typeof(T).IsDto();
119119
foreach (var propertyInfo in TypeConfig<T>.Properties)
120120
{
121-
if (!propertyInfo.CanWrite || propertyInfo.GetSetMethod() == null) continue;
121+
if (!propertyInfo.CanWrite || propertyInfo.SetMethod() == null) continue;
122122
if (!TypeSerializer.CanCreateFromString(propertyInfo.PropertyType)) continue;
123123

124124
var propertyName = propertyInfo.Name;

src/ServiceStack.Text/CsvSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ public static T ConvertFrom(object results)
498498
return (T)results;
499499
}
500500

501-
foreach (var ci in typeof(T).GetConstructors())
501+
foreach (var ci in typeof(T).GetAllConstructors())
502502
{
503503
var ciParams = ci.GetParameters();
504504
if (ciParams.Length == 1)

src/ServiceStack.Text/ReflectionExtensions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,15 @@ public static ConstructorInfo GetEmptyConstructor(this Type type)
892892
#endif
893893
}
894894

895+
public static ConstructorInfo[] GetAllConstructors(this Type type)
896+
{
897+
#if (NETFX_CORE || PCL)
898+
return type.GetTypeInfo().DeclaredConstructors;
899+
#else
900+
return type.GetConstructors();
901+
#endif
902+
}
903+
895904
internal static PropertyInfo[] GetTypesPublicProperties(this Type subType)
896905
{
897906
#if (NETFX_CORE || PCL)

0 commit comments

Comments
 (0)