private static IReadOnlyCollection <INamedTypeSymbol> GetDisallowedCatchTypes(Compilation compilation) { return(ImmutableHashSet.CreateRange( new[] { WellKnownTypes.Object(compilation), WellKnownTypes.Exception(compilation), WellKnownTypes.SystemException(compilation) }.Where(x => x != null))); }
/// <summary> /// Check whether given symbol is from mscorlib /// </summary> public static bool IsFromMscorlib(this ISymbol symbol, Compilation compilation) { var @object = WellKnownTypes.Object(compilation); return(symbol.ContainingAssembly?.Equals(@object.ContainingAssembly) == true); }