Skip to content

API Host AuroraCompilationDiagnostic

Liu.Yandong.Hanks edited this page Aug 19, 2026 · 2 revisions

AuroraCompilationDiagnostic

面向宿主公开的单条脚本编译诊断信息。

Single script compilation diagnostic exposed to hosts.

命名空间:AuroraScript。类型:class。

Namespace: AuroraScript. Kind: class.

返回 .NET Host API 参考

Back to .NET Host API Reference

用途

Purpose

AuroraCompilationDiagnostic 是公开宿主类型。通过下方签名选择调用方式;对运行时对象、生命周期和异常,应由宿主在边界处明确处理。

Single script compilation diagnostic exposed to hosts.

简单示例

Simple Example

下面是 AuroraCompilationDiagnostic 的最小使用方式。

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}");
}

成员

Members

string Message

读取 Message 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 string

Returns string.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

AuroraCompilationDiagnostic value = /* 从宿主 API 获取实例 */;
var current = value.Message;

SourceSpan Location

读取 Location 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 SourceSpan

Returns SourceSpan.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

AuroraCompilationDiagnostic value = /* 从宿主 API 获取实例 */;
var current = value.Location;

string FileName

读取 FileName 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 string

Returns string.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

AuroraCompilationDiagnostic value = /* 从宿主 API 获取实例 */;
var current = value.FileName;

int LineNumber

读取 LineNumber 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 int

Returns int.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

AuroraCompilationDiagnostic value = /* 从宿主 API 获取实例 */;
var current = value.LineNumber;

int ColumnNumber

读取 ColumnNumber 属性。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 int

Returns int.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

AuroraCompilationDiagnostic value = /* 从宿主 API 获取实例 */;
var current = value.ColumnNumber;

string ToString()

调用 ToString 完成其公开操作。

Use the member according to its public signature.

Parameters:

  • 无。

    None.

Returns

返回 string

Returns string.

调用示意

以下示例展示调用形状;将占位实例和参数替换为宿主中的实际值。

The example shows the call shape; replace placeholder instances and arguments with actual host values.

AuroraCompilationDiagnostic value = /* 从宿主 API 获取实例 */;
var result = value.ToString();

Clone this wiki locally