Esempio n. 1
0
        /// <summary>
        /// Writes the diagnostic and the offending code.
        /// </summary>
        /// <returns>A string for use in assert exception</returns>
        internal static async Task <string> ToStringAsync(this Diagnostic diagnostic, Solution solution)
        {
            var sources = await Task.WhenAll(solution.Projects.SelectMany(p => p.Documents).Select(d => CodeReader.GetStringFromDocumentAsync(d, Formatter.Annotation, CancellationToken.None)));

            return(diagnostic.ToString(sources));
        }