internal AttributeDiagnosticContext( MSBuildAnalysisSession session, MSBuildAttribute attribute) { this.session = session; Attribute = attribute; }
static bool IsConditionInvalidForPackageReferences(MSBuildAttribute condition) { foreach (var prop in condition.Value.WithAllDescendants().OfType <ExpressionPropertyName> ()) { if (!string.Equals(prop.Name, "TargetFramework", StringComparison.OrdinalIgnoreCase)) { return(true); } } return(false); }
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); } } } }