Skip to content

Commit

Permalink
try/catch when calling ParameterBuilder.SetConstant (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
slozier authored Feb 15, 2019
1 parent 19f63b7 commit 5ab5ab0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Src/Microsoft.Dynamic/Utils/ReflectionUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,9 @@ public static void CopyMethodSignature(MethodInfo from, MethodBuilder to, bool s

for (int i = 0; i < paramInfos.Length; i++) {
var parameterBuilder = to.DefineParameter(i + 1, paramInfos[i].Attributes, paramInfos[i].Name);
if (paramInfos[i].HasDefaultValue) parameterBuilder.SetConstant(paramInfos[i].RawDefaultValue);
try { // ParameterBuilder.SetConstant is buggy and may fail on Mono
if (paramInfos[i].HasDefaultValue) parameterBuilder.SetConstant(paramInfos[i].RawDefaultValue);
} catch { }
}
}

Expand Down

0 comments on commit 5ab5ab0

Please sign in to comment.