Skip to content

Commit

Permalink
Catch FormatException coming from Convert.ChangeType. (#1635)
Browse files Browse the repository at this point in the history
String.TrimEnd has a new overload for a single char in .NET Core 2.0. However, when MSBuild encounters this new overload first, it throws a FormatException which is not caught - breaking the build.

The fix is to catch the FormatException just like an InvalidCastException and continue searching the rest of the reflection MethodInfos for a match.

Fix #1634
  • Loading branch information
eerhardt authored and rainersigwald committed Feb 1, 2017
1 parent f3fc434 commit f354022
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/XMakeBuildEngine/Evaluation/Expander.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3608,9 +3608,13 @@ private static object[] CoerceArguments(object[] args, ParameterInfo[] parameter
}
}
}
// The coercion failed therefore we return null
catch (InvalidCastException)
{
// The coercion failed therefore we return null
return null;
}
catch (FormatException)
{
return null;
}

Expand Down

0 comments on commit f354022

Please sign in to comment.