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

Commit 863c968

Browse files
committed
Fix SL5 build errors
1 parent 828fa9c commit 863c968

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ServiceStack.Text/AutoMappingUtils.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static T ConvertTo<T>(this object from)
2727

2828
if (from.GetType().IsValueType())
2929
{
30-
return (T)Convert.ChangeType(from, typeof(T));
30+
return (T)Convert.ChangeType(from, typeof(T), provider:null);
3131
}
3232

3333
if (typeof(IEnumerable).IsAssignableFromType(typeof(T)))
@@ -699,7 +699,7 @@ public static PropertyGetterDelegate CreateTypeConverter(Type fromType, Type toT
699699
{
700700
if (toType.IsEnum() && fromType.IsEnum())
701701
{
702-
return fromValue => Enum.Parse(toType, fromValue.ToString());
702+
return fromValue => Enum.Parse(toType, fromValue.ToString(), ignoreCase:true);
703703
}
704704
if (toType.IsNullableType())
705705
{
@@ -730,7 +730,7 @@ public static PropertyGetterDelegate CreateTypeConverter(Type fromType, Type toT
730730
}
731731
else if (toType.IsValueType())
732732
{
733-
return fromValue => Convert.ChangeType(fromValue, toType);
733+
return fromValue => Convert.ChangeType(fromValue, toType, provider:null);
734734
}
735735
else
736736
{

tests/ServiceStack.Text.Tests/AutoMappingBenchmarks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public void Compare_handwritten_vs_AutoMapping()
169169
public void Does_Convert_BenchSource()
170170
{
171171
var from = new BenchSource();
172-
var to = from.ConvertTo<BenchDestination>();
172+
var to = from.ConvertTo<BenchDestination>(); //warmup
173173
to = from.ConvertTo<BenchDestination>();
174174

175175
using (JsConfig.With(includePublicFields: true))

0 commit comments

Comments
 (0)