internal AnalyzerExecutionScope(Analyzer executingAnalyzer) { if (_current != null) { throw new InvalidOperationException(); } ExecutingAnalyzer = executingAnalyzer; _current = this; }
/// <summary> /// Create a new instance of AnalyzerIssue. /// </summary> /// <param name="title">A string title.</param> /// <param name="description">A string description.</param> /// <param name="url">A URL pointing to further documentation.</param> /// <exception cref="InvalidOperationException">Instances of AnalyzerIssue can only be created during Analyzer execution.</exception> public AnalyzerIssue( string title, string description, string url) { // Get a reference to the currently executing analyzer. AnalyzerExecutionScope current = AnalyzerExecutionScope.Current; if (current == null) { throw new InvalidOperationException("Must be created during analyzer execution."); } Analyzer = current.ExecutingAnalyzer; Title = title; Description = description; URL = url; }
void IDisposable.Dispose() { _current = null; }