Skip to content

API Host AuroraCompilationDiagnostic

Liu.Yandong.Hanks edited this page Aug 21, 2026 · 3 revisions

AuroraCompilationDiagnostic

Single script compilation diagnostic exposed to hosts.

Namespace: AuroraScript. Kind: class.

Back to .NET Host API Reference

Overview

AuroraCompilationDiagnostic carries one compilation problem reported by the compiler: a message and the source location it belongs to. Hosts normally reach diagnostics through AuroraCompilationException, which exposes the full list plus the first entry.

Location is the authoritative range; FileName, LineNumber, and ColumnNumber are display-friendly projections of it.

Quick Reference

A minimal use of AuroraCompilationDiagnostic.

try
{
    await engine.BuildAsync("main.as");
}
catch (AuroraCompilationException ex)
{
    var diagnostic = ex.FirstDiagnostic;
    Console.Error.WriteLine($"{diagnostic.FileName}:{diagnostic.LineNumber}");
}

Properties

Message

string Message

Diagnostic text describing the compilation problem.

Parameters

None.

Returns

Returns string.

Console.Error.WriteLine(diagnostic.Message);

Location

SourceSpan Location

Source range the diagnostic points at.

Parameters

None.

Returns

Returns SourceSpan.

Behavior

Location is a SourceSpan and can be SourceSpan.None when the compiler has no usable range.

var span = diagnostic.Location;
Console.Error.WriteLine($"{span.StartLine}:{span.StartColumn}");

FileName

string FileName

Source file name reported for the diagnostic.

Parameters

None.

Returns

Returns string.

Console.Error.WriteLine(diagnostic.FileName);

LineNumber

int LineNumber

Line the diagnostic points at.

Parameters

None.

Returns

Returns int.

Console.Error.WriteLine(diagnostic.LineNumber);

ColumnNumber

int ColumnNumber

Column the diagnostic points at.

Parameters

None.

Returns

Returns int.

Console.Error.WriteLine(diagnostic.ColumnNumber);

Methods

ToString

string ToString()

Formats the diagnostic as displayable text.

Parameters

None.

Returns

Returns string.

Console.Error.WriteLine(diagnostic.ToString());

Clone this wiki locally