Description
The Exception
property of the CompilerOutput
class provides access to any exception that occurred during the build process. If an error or unexpected condition arises while compiling, this property will contain the relevant System.Exception
object, allowing you to inspect the details of the failure.
Usage
Use the Exception
property to check if an exception was thrown during the build process. This can be useful for debugging and logging purposes. If the build was successful, this property will be null
.
Example
// Example of accessing the Exception property
CompilerOutput output = BuildProject();
if (!output.Successful)
{
if (output.Exception != null)
{
// Log or handle the exception
LogError(output.Exception.Message);
}
else
{
// Handle other build issues
LogError("Build failed without an exception.");
}
}