예제 #1
0
        internal AnalyzerExecutionScope(Analyzer executingAnalyzer)
        {
            if (_current != null)
            {
                throw new InvalidOperationException();
            }

            ExecutingAnalyzer = executingAnalyzer;
            _current          = this;
        }
예제 #2
0
        /// <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;
        }
예제 #3
0
 void IDisposable.Dispose()
 {
     _current = null;
 }