Skip to content

Commit

Permalink
Cater net 45 and non-compiling solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamTheCoder committed Feb 24, 2024
1 parent 18e8526 commit ee21027
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ private static bool IsStringType(this ITypeSymbol @this)

private static bool IsObjectType(this ITypeSymbol @this)
{
return @this.SpecialType == SpecialType.System_Object;
return @this?.SpecialType == SpecialType.System_Object;
}

private static bool IsDecimalType(this ITypeSymbol @this)
Expand Down
2 changes: 1 addition & 1 deletion CodeConverter/CSharp/CommonConversions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -756,5 +756,5 @@ public bool IsLinqDelegateExpression(VisualBasicSyntaxNode node)
return false;
}

private bool IsLinqDelegateExpression(ITypeSymbol convertedType) => System_Linq_Expressions_Expression_T.Equals(convertedType?.OriginalDefinition, SymbolEqualityComparer.Default);
private bool IsLinqDelegateExpression(ITypeSymbol convertedType) => System_Linq_Expressions_Expression_T?.Equals(convertedType?.OriginalDefinition, SymbolEqualityComparer.Default) == true;
}
4 changes: 3 additions & 1 deletion CodeConverter/CSharp/MethodInfoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ private static TDesiredFunc CreateOpenInstanceDelegateForcingType<TDesiredFunc>(
public static MethodInfo ReflectedPropertyGetter<TInstance>(this TInstance instance,
string propertyToAccess)
{
var propertyInfo = instance.GetType().GetProperty(propertyToAccess, BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
var type = instance.GetType();
var propertyInfo = type.GetProperty(propertyToAccess, BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
propertyInfo ??= type.ReflectedType?.GetProperty(propertyToAccess, BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
return propertyInfo?.GetMethod.GetRuntimeBaseDefinition();
}
}

0 comments on commit ee21027

Please sign in to comment.