You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft.NET.TargetFrameworkInference.targets(51,4): error MSB4184: The expression ""netcoreapp2.0".TrimEnd(.0123456789)" cannot be evaluated. String must be exactly one character long.
else
{
// change the type of the final unescaped string into the destination
coercedArguments[n] = Convert.ChangeType(args[n], parameters[n].ParameterType, CultureInfo.InvariantCulture);
}
}
}
catch (InvalidCastException)
{
// The coercion failed therefore we return null
return null;
The issue is Convert.ChangeType is throwing a FormatException, just like it is documented to do. But this code only catches InvalidCastException. Instead, since trying to convert a string to a single char fails, this method overload should be skipped and keep searching until it finds the overload that accepts char[].
This is blocking the CLI "2.0" work from taking new builds of the .NET Core runtime.
The text was updated successfully, but these errors were encountered:
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.
Fixdotnet#1634
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
eerhardt
added a commit
to dotnet/cli
that referenced
this issue
Feb 1, 2017
CoreFX has added a new String.TrimEnd overload with dotnet/corefx#15334.
This is breaking MSBuild running on netcoreapp2.0 when building a project that contains logic like the following taken from dotnet/sdk:
I get the following error:
I've debugged the error down to this logic in MSBuild:
The issue is
Convert.ChangeType
is throwing aFormatException
, just like it is documented to do. But this code only catchesInvalidCastException
. Instead, since trying to convert a string to a single char fails, this method overload should be skipped and keep searching until it finds the overload that acceptschar[]
.This is blocking the CLI "2.0" work from taking new builds of the .NET Core runtime.
The text was updated successfully, but these errors were encountered: