Skip to content

Commit

Permalink
Removes dead code from type conversion (#19436)
Browse files Browse the repository at this point in the history
The removed code would only run if `converter` was not null. But in that case the if on line 166 would match and it would return from the method. So the removed code can only be reached if `converter` is null.
  • Loading branch information
vitek-karas authored Feb 12, 2024
1 parent 3047f13 commit 604c217
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/Controls/src/Core/Xaml/TypeConversionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,6 @@ internal static object ConvertTo(this object value, Type toType, Func<TypeConver
return null;
}

if (converter != null)
{
try
{
return converter.ConvertFromInvariantString(str);
}
catch (Exception e)
{
exception = new XamlParseException("Type conversion failed", serviceProvider, e);
return null;
}
}

var ignoreCase = (serviceProvider?.GetService(typeof(IConverterOptions)) as IConverterOptions)?.IgnoreCase ?? false;

//If the type is nullable, as the value is not null, it's safe to assume we want the built-in conversion
Expand Down

0 comments on commit 604c217

Please sign in to comment.