diff --git a/CodeConverter/CSharp/CachedReflectedDelegates.cs b/CodeConverter/CSharp/CachedReflectedDelegates.cs index 94a73018..3d036b0c 100644 --- a/CodeConverter/CSharp/CachedReflectedDelegates.cs +++ b/CodeConverter/CSharp/CachedReflectedDelegates.cs @@ -26,8 +26,15 @@ public static SyntaxTree GetEmbeddedSyntaxTree(this Location loc) => GetCachedReflectedPropertyDelegate(loc, "PossiblyEmbeddedOrMySourceTree", ref _possiblyEmbeddedOrMySourceTree); private static Func _possiblyEmbeddedOrMySourceTree; - public static bool GetIsUsing(this ILocalSymbol l) => - GetCachedReflectedPropertyDelegate(l, "IsUsing", ref _isUsing); + public static bool GetIsUsing(this ILocalSymbol l) + { + try { + return GetCachedReflectedPropertyDelegate(l, "IsUsing", ref _isUsing); + } catch (Exception) { + return false; + } + } + private static Func _isUsing;