本文整理汇总了C#中AnalysisContext.EnableConcurrentExecution方法的典型用法代码示例。如果您正苦于以下问题:C# AnalysisContext.EnableConcurrentExecution方法的具体用法?C# AnalysisContext.EnableConcurrentExecution怎么用?C# AnalysisContext.EnableConcurrentExecution使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnalysisContext
的用法示例。
在下文中一共展示了AnalysisContext.EnableConcurrentExecution方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public override void Initialize(AnalysisContext analysisContext)
{
analysisContext.EnableConcurrentExecution();
analysisContext.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
analysisContext.RegisterCompilationAction(AnalyzeCompilation);
}
示例2: Initialize
public override void Initialize(AnalysisContext context)
{
context.EnableConcurrentExecution();
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
context.RegisterCompilationStartAction(compilationContext =>
{
var exportAttributes = new List<INamedTypeSymbol>();
foreach (var mefNamespace in s_mefNamespaces)
{
var exportAttribute = compilationContext.Compilation.GetTypeByMetadataName(mefNamespace + ".ExportAttribute");
if (exportAttribute == null)
{
// We don't need to check assemblies unless they're referencing both versions of MEF, so we're done
return;
}
exportAttributes.Add(exportAttribute);
}
compilationContext.RegisterSymbolAction(c => AnalyzeSymbol(c, exportAttributes), SymbolKind.NamedType);
});
}
示例3: Initialize
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
{
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
context.EnableConcurrentExecution();
context.RegisterSyntaxNodeAction(DoStatementAction, SyntaxKind.DoStatement);
}
开发者ID:EdwinEngelen,项目名称:StyleCopAnalyzers,代码行数:8,代码来源:SA1511WhileDoFooterMustNotBePrecededByBlankLine.cs
示例4: Initialize
public override void Initialize(AnalysisContext analysisContext)
{
analysisContext.EnableConcurrentExecution();
analysisContext.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
analysisContext.RegisterSymbolAction(
symbolAnalysisContext =>
{
ISymbol symbol = symbolAnalysisContext.Symbol;
if (!symbol.ContainingType.IsGenericType ||
symbol.DeclaredAccessibility != Accessibility.Public ||
!symbol.IsStatic)
{
return;
}
var methodSymbol = symbol as IMethodSymbol;
if (methodSymbol != null &&
(methodSymbol.IsAccessorMethod() ||
(methodSymbol.MethodKind == MethodKind.UserDefinedOperator &&
(methodSymbol.Name == WellKnownMemberNames.EqualityOperatorName ||
methodSymbol.Name == WellKnownMemberNames.InequalityOperatorName))))
{
return;
}
symbolAnalysisContext.ReportDiagnostic(symbol.CreateDiagnostic(Rule, symbol.Name));
}, SymbolKind.Method, SymbolKind.Property);
}
示例5: Initialize
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
{
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
context.EnableConcurrentExecution();
context.RegisterSyntaxNodeAction(RegionDirectiveTriviaAction, SyntaxKind.RegionDirectiveTrivia);
}
示例6: Initialize
public override void Initialize(AnalysisContext analysisContext)
{
analysisContext.EnableConcurrentExecution();
analysisContext.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
analysisContext.RegisterSyntaxNodeAction<SyntaxKind>(AnalyzeNode, SyntaxKind.ThrowStatement);
}
示例7: Initialize
public override void Initialize(AnalysisContext context)
{
context.EnableConcurrentExecution();
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
context.RegisterSyntaxNodeAction(AnalyzeXmlAttribute, SyntaxKind.XmlTextAttribute);
}
示例8: Initialize
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
{
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
context.EnableConcurrentExecution();
context.RegisterSyntaxNodeAction(EnumMemberDeclarationAction, SyntaxKind.EnumMemberDeclaration);
}
示例9: Initialize
public override void Initialize(AnalysisContext analysisContext)
{
analysisContext.EnableConcurrentExecution();
analysisContext.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
analysisContext.RegisterCompilationStartAction(
(context) =>
{
INamedTypeSymbol dllImportType = context.Compilation.GetTypeByMetadataName("System.Runtime.InteropServices.DllImportAttribute");
if (dllImportType == null)
{
return;
}
INamedTypeSymbol marshalAsType = context.Compilation.GetTypeByMetadataName("System.Runtime.InteropServices.MarshalAsAttribute");
if (marshalAsType == null)
{
return;
}
INamedTypeSymbol stringBuilderType = context.Compilation.GetTypeByMetadataName("System.Text.StringBuilder");
if (stringBuilderType == null)
{
return;
}
INamedTypeSymbol unmanagedType = context.Compilation.GetTypeByMetadataName("System.Runtime.InteropServices.UnmanagedType");
if (unmanagedType == null)
{
return;
}
context.RegisterSymbolAction(new SymbolAnalyzer(dllImportType, marshalAsType, stringBuilderType, unmanagedType).AnalyzeSymbol, SymbolKind.Method);
});
}
示例10: Initialize
public override void Initialize(AnalysisContext analysisContext)
{
analysisContext.EnableConcurrentExecution();
analysisContext.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
analysisContext.RegisterCompilationStartAction(
compilationContext =>
{
Compilation compilation = compilationContext.Compilation;
ITypeSymbol argumentExceptionType = compilation.GetTypeByMetadataName("System.ArgumentException");
if (argumentExceptionType == null)
{
return;
}
compilationContext.RegisterOperationBlockStartAction(
operationBlockStartContext =>
{
operationBlockStartContext.RegisterOperationAction(
operationContext => AnalyzeObjectCreation(
operationContext,
operationBlockStartContext.OwningSymbol,
argumentExceptionType),
OperationKind.ObjectCreationExpression);
});
});
}
示例11: Initialize
public override void Initialize(AnalysisContext analysisContext)
{
analysisContext.EnableConcurrentExecution();
analysisContext.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
analysisContext.RegisterCompilationStartAction(compilationContext =>
{
INamedTypeSymbol conditionalAttributeSymbol = WellKnownTypes.ConditionalAttribute(compilationContext.Compilation);
compilationContext.RegisterOperationBlockAction(context =>
{
var method = context.OwningSymbol as IMethodSymbol;
if (method == null)
{
return;
}
if (!method.IsFinalizer())
{
return;
}
if (IsEmptyFinalizer(context.OperationBlocks, conditionalAttributeSymbol))
{
context.ReportDiagnostic(context.OwningSymbol.CreateDiagnostic(Rule));
}
});
});
}
示例12: Initialize
public override void Initialize(AnalysisContext analysisContext)
{
analysisContext.EnableConcurrentExecution();
analysisContext.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
analysisContext.RegisterSymbolAction(symbolContext =>
{
var method = (IMethodSymbol)symbolContext.Symbol;
if (!IsEventLikeNameCandidate(method.Name))
{
Debug.Assert(!HasEventLikeName(method), "fast check failed but eventual check succeeds?");
return;
}
// Bail out for implicitly declared methods, overridden methods, interface implementations, constructors and finalizers (FxCop compat).
if (method.IsImplicitlyDeclared ||
method.IsOverride ||
method.IsImplementationOfAnyInterfaceMember() ||
method.IsConstructor() ||
method.IsFinalizer())
{
return;
}
if (HasEventLikeName(method))
{
// Consider making '{0}' an event.
var diagnostic = method.CreateDiagnostic(Rule, method.Name);
symbolContext.ReportDiagnostic(diagnostic);
}
}, SymbolKind.Method);
}
示例13: Initialize
public override void Initialize(AnalysisContext analysisContext)
{
analysisContext.EnableConcurrentExecution();
analysisContext.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
analysisContext.RegisterCompilationStartAction(
(context) =>
{
INamedTypeSymbol iCollectionType = WellKnownTypes.ICollection(context.Compilation);
INamedTypeSymbol genericICollectionType = WellKnownTypes.GenericICollection(context.Compilation);
INamedTypeSymbol iEnumerableType = WellKnownTypes.IEnumerable(context.Compilation);
INamedTypeSymbol genericIEnumerableType = WellKnownTypes.GenericIEnumerable(context.Compilation);
INamedTypeSymbol iListType = WellKnownTypes.IList(context.Compilation);
INamedTypeSymbol genericIListType = WellKnownTypes.GenericIList(context.Compilation);
if (iCollectionType == null && genericICollectionType == null &&
iEnumerableType == null && genericIEnumerableType == null &&
iListType == null && genericIListType == null)
{
return;
}
context.RegisterSymbolAction(c => AnalyzeSymbol(c,
iCollectionType, genericICollectionType,
iEnumerableType, genericIEnumerableType,
iListType, genericIListType),
SymbolKind.NamedType);
});
}
示例14: Initialize
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
{
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
context.EnableConcurrentExecution();
context.RegisterSyntaxNodeAction(TypeParameterConstraintClauseAction, SyntaxKind.TypeParameterConstraintClause);
}
开发者ID:EdwinEngelen,项目名称:StyleCopAnalyzers,代码行数:8,代码来源:SA1127GenericTypeConstraintsMustBeOnOwnLine.cs
示例15: Initialize
public override void Initialize(AnalysisContext analysisContext)
{
analysisContext.EnableConcurrentExecution();
analysisContext.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
analysisContext.RegisterCompilationStartAction(
(context) =>
{
INamedTypeSymbol eventHandler = WellKnownTypes.EventHandler(context.Compilation);
if (eventHandler == null)
{
return;
}
INamedTypeSymbol genericEventHandler = WellKnownTypes.GenericEventHandler(context.Compilation);
if (genericEventHandler == null)
{
return;
}
INamedTypeSymbol eventArgs = WellKnownTypes.EventArgs(context.Compilation);
if (eventArgs == null)
{
return;
}
INamedTypeSymbol comSourceInterfacesAttribute = WellKnownTypes.ComSourceInterfaceAttribute(context.Compilation);
if (comSourceInterfacesAttribute == null)
{
return;
}
context.RegisterSymbolAction(GetAnalyzer(context.Compilation, eventHandler, genericEventHandler, eventArgs, comSourceInterfacesAttribute).AnalyzeSymbol, SymbolKind.Event);
});
}