Description
The Diagnostics
property provides a collection of diagnostic messages, including warnings and errors, that were generated during the last build process. This property is useful for analyzing and debugging the build process by examining the issues that occurred.
Usage
To access the diagnostics from the last build, you can use the Diagnostics
property of the Compiler
class. This property returns an array of Microsoft.CodeAnalysis.Diagnostic
objects, each representing a specific issue encountered during the build.
Example usage:
var compiler = new Compiler();
var diagnostics = compiler.Diagnostics;
foreach (var diagnostic in diagnostics)
{
Console.WriteLine($"{diagnostic.Id}: {diagnostic.GetMessage()}");
}
Example
var compiler = new Compiler();
var diagnostics = compiler.Diagnostics;
foreach (var diagnostic in diagnostics)
{
Console.WriteLine($"{diagnostic.Id}: {diagnostic.GetMessage()}");
}