Skip to content

Commit 18e8526

Browse files
Catch when it's a different type or the method is missing due to version issues
1 parent c0745d8 commit 18e8526

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

CodeConverter/CSharp/CachedReflectedDelegates.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@ public static SyntaxTree GetEmbeddedSyntaxTree(this Location loc) =>
2626
GetCachedReflectedPropertyDelegate(loc, "PossiblyEmbeddedOrMySourceTree", ref _possiblyEmbeddedOrMySourceTree);
2727
private static Func<Location, SyntaxTree> _possiblyEmbeddedOrMySourceTree;
2828

29-
public static bool GetIsUsing(this ILocalSymbol l) =>
30-
GetCachedReflectedPropertyDelegate(l, "IsUsing", ref _isUsing);
29+
public static bool GetIsUsing(this ILocalSymbol l)
30+
{
31+
try {
32+
return GetCachedReflectedPropertyDelegate(l, "IsUsing", ref _isUsing);
33+
} catch (Exception) {
34+
return false;
35+
}
36+
}
37+
3138
private static Func<ILocalSymbol, bool> _isUsing;
3239

3340

0 commit comments

Comments
 (0)