Table of Contents

Class BuildConfigurationException

Namespace
Invex.Atom.Build.Exceptions
Assembly
Invex.Atom.Build.dll

Thrown when the build configuration contains errors such as duplicate targets, missing dependencies, or circular dependencies.

public class BuildConfigurationException : AtomException
Inheritance
object
Exception
BuildConfigurationException

Examples

Example 1: Duplicate target error with ListReportData

throw new BuildConfigurationException("One or more targets are defined multiple times.")
{
    ReportData = new ListReportData(new[] { "Target 'Build' is defined multiple times" })
    {
        Title = "Duplicate Targets"
    }
};

Example 2: Circular dependency error with TextReportData

throw new BuildConfigurationException("Circular dependency detected: Build -> Test -> Build")
{
    ReportData = new TextReportData("Dependency cycle:\n  Build -> Test -> Build")
    {
        Title = "Circular Dependency Detected"
    }
};

Example 3: Missing dependency error

throw new BuildConfigurationException("Target 'Build' depends on target 'Compile' which does not exist.");

Example 4: How to catch and handle

try
{
    var buildModel = buildResolver.Resolve();
}
catch (BuildConfigurationException ex)
{
    Console.WriteLine($"Configuration error: {ex.Message}");
    if (ex.ReportData is not null)
    {
        reportService.AddReportData(ex.ReportData);
    }
}

Remarks

This exception is thrown during build model resolution when the Invex.Atom.Build.BuildResolver detects configuration errors that prevent the build from proceeding. Common scenarios include:

  • Duplicate target names defined in the build
  • A target depends on a non-existent target
  • Circular dependencies between targets

The exception may include a ReportData property with enhanced error details that can be rendered for better visualization of the configuration problem.

Constructors

BuildConfigurationException()

Initializes a new instance of the BuildConfigurationException class.

public BuildConfigurationException()

BuildConfigurationException(string)

Initializes a new instance of the BuildConfigurationException class with a specified error message.

public BuildConfigurationException(string message)

Parameters

message string

The message that describes the error.

BuildConfigurationException(string, Exception)

Initializes a new instance of the BuildConfigurationException class with a specified error message and a reference to the inner exception that is the cause of this exception.

public BuildConfigurationException(string message, Exception innerException)

Parameters

message string

The error message that explains the reason for the exception.

innerException Exception

The exception that is the cause of the current exception, or null if no inner exception is specified.

Properties

ReportData

Gets optional enhanced error details that can be rendered to provide better visualization of the configuration problem.

public ICustomReportData? ReportData { get; init; }

Property Value

ICustomReportData

Remarks

This property can contain ListReportData for listing multiple issues, or TextReportData for formatted text output, or any other ICustomReportData implementation.

See Also

AtomException
BuildResolver