private static string CipherName(ITypeSymbol containingType)
 {
     if (containingType.Is(KnownType.System_Security_Cryptography_DSA) ||
         containingType.DerivesFrom(KnownType.System_Security_Cryptography_DSA))
     {
         return("DSA");
     }
     return("RSA");
 }
        private static bool IsEventArgs(ITypeSymbol type, Compilation compilation)
        {
            if (type.DerivesFrom(WellKnownTypes.EventArgs(compilation)))
            {
                return(true);
            }

            if (type.IsValueType)
            {
                return(type.Name.EndsWith("EventArgs", StringComparison.Ordinal));
            }

            return(false);
        }
        private static bool IsEventArgs(ITypeSymbol type, Compilation compilation)
        {
            if (type.DerivesFrom(compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemEventArgs)))
            {
                return(true);
            }

            if (type.IsValueType)
            {
                return(type.Name.EndsWith("EventArgs", StringComparison.Ordinal));
            }

            return(false);
        }
Exemple #4
0
            protected override DisposeAbstractValue HandleInstanceCreation(ITypeSymbol instanceType, PointsToAbstractValue instanceLocation, DisposeAbstractValue defaultValue)
            {
                defaultValue = DisposeAbstractValue.NotDisposable;

                if (!instanceType.IsDisposable(WellKnownTypeProvider.IDisposable))
                {
                    return(defaultValue);
                }

                // Special case: Do not track System.Threading.Tasks.Task as you are not required to dispose them.
                if (WellKnownTypeProvider.Task != null && instanceType.DerivesFrom(WellKnownTypeProvider.Task, baseTypesOnly: true))
                {
                    return(defaultValue);
                }

                SetAbstractValue(instanceLocation, DisposeAbstractValue.NotDisposed);
                return(DisposeAbstractValue.NotDisposed);
            }
Exemple #5
0
 public static bool IsXmlReaderType(ITypeSymbol symbol, CompilationSecurityTypes xmlTypes)
 {
     return(symbol != null &&
            symbol.DerivesFrom(xmlTypes.XmlReader, baseTypesOnly: true));
 }
 public static bool IsXmlReaderType(ITypeSymbol symbol, CompilationSecurityTypes xmlTypes)
 {
     return symbol != null
         && symbol.DerivesFrom(xmlTypes.XmlReader, baseTypesOnly: true);
 }
 private static bool IsDerivedFromEventArgs(ITypeSymbol type) =>
 type.DerivesFrom(KnownType.System_EventArgs) ||
 (type is ITypeParameterSymbol typeParameterSymbol &&
 public static bool DerivesOrImplements(this ITypeSymbol type, ITypeSymbol baseType)
 {
     return(type.Implements(baseType) ||
            type.DerivesFrom(baseType));
 }
 public static bool IsXmlSecureResolverType(ITypeSymbol symbol, XxeSecurityTypes xmlTypes)
 {
     return(symbol != null && symbol.DerivesFrom(xmlTypes.XmlSecureResolver, baseTypesOnly: true));
 }
 protected static bool DerivesFromSafeHandle(ITypeSymbol typeSymbol)
 {
     return(typeSymbol.DerivesFrom(KnownType.System_Runtime_InteropServices_SafeHandle));
 }
        private static bool IsEventArgs(ITypeSymbol type, Compilation compilation)
        {
            if (type.DerivesFrom(WellKnownTypes.EventArgs(compilation)))
            {
                return true;
            }

            if (type.IsValueType)
            {
                return type.Name.EndsWith("EventArgs", StringComparison.Ordinal);
            }

            return false;
        }
Exemple #12
0
 private static bool IsSignalRHubMethod(ITypeSymbol typeSymbol) =>
 typeSymbol.DerivesFrom(KnownType.Microsoft_AspNet_SignalR_Hub);