예제 #1
0
 public void ExecuteAttributeActions(XElement element, XAttribute attribute, MSBuildElementSyntax resolvedElement, MSBuildAttributeSyntax resolvedAttribute)
 {
     if (Context.GetAttributeActions(resolvedAttribute?.SyntaxKind ?? MSBuildSyntaxKind.Unknown, out var actions))
     {
         var ctx = new AttributeDiagnosticContext(this, element, attribute, resolvedElement, resolvedAttribute);
         foreach (var(analyzer, action) in actions)
         {
             try {
                 if (!analyzer.Disabled)
                 {
                     action(ctx);
                 }
             } catch (Exception ex) {
                 Context.ReportAnalyzerError(analyzer, ex);
             }
         }
     }
 }
 public void ExecuteAttributeActions(MSBuildAttribute attribute)
 {
     if (Context.GetAttributeActions(attribute.SyntaxKind, out var actions))
     {
         var ctx = new AttributeDiagnosticContext(this, attribute);
         foreach (var(analyzer, action) in actions)
         {
             try {
                 if (!analyzer.Disabled)
                 {
                     action(ctx);
                 }
             } catch (Exception ex) {
                 Context.ReportAnalyzerError(analyzer, ex);
             }
         }
     }
 }