# Diagnostics and Quality Proof

Nexamas UI exposes safe public diagnostics through `MASApplication.Diagnostics`. Release-quality proof remains a maintainer operation through the documentation, source-contract, commercial, package, and external-consumer gates.

## Public runtime diagnostics

```vbnet
Dim snapshot = MASApplication.Diagnostics.GetSnapshot(maxRecentFaults:=32)

If snapshot.HasFaults Then
    Dim fault = snapshot.MostRecentFault
    Console.WriteLine(fault.Category & ": " & fault.Message)
End If
```

The public snapshot intentionally exposes summaries only. It does not expose mutable diagnostics channels, source file paths, source line numbers, or internal runtime fault records.

## Runtime configuration for development sessions

Call before creating the first MAS window:

```vbnet
MASApplication.ConfigureRuntime(
    enableDiagnosticsDiskLogging:=True,
    throwOnSwallowedException:=False,
    traceRepeatedBoundaryExceptions:=True)
```

## Maintainer proof commands

Run from the repository root on Windows:

```powershell
.\tools\docs\Invoke-NexamasUIDocumentationGate.ps1
.\eng\tests\Run-NexamasUITestSuite.ps1 -Configuration Release -Platform x64
.\eng\ci\Pack-Nexamas.UI.ps1 -Configuration Release -Platform x64
.\eng\ci\Test-NexamasUIPackedConsumer.ps1 -Configuration Release -Platform x64
```

For a one-command validation wrapper, use the Windows validation runner documented in the reference pages.

## What each proof means

| Proof | Meaning |
|---|---|
| Documentation gate | Documentation structure, claim ledger, links, and compile boundary are clean |
| Source-contract suite | Source-level architectural and API freeze gates pass |
| Pack script | The NuGet and symbol packages can be produced from the current source |
| Packed consumer proof | A separate consumer probe can restore, build, and run against the package |

## Related pages

- [Packaging and external consumer use](packaging-and-external-consumer-use.md)
- [Quality proof guide](../quality-proof-guide.md)
- [Windows validation runbook](../developer/windows-validation-runbook.md)
- [Documentation gate reference](../reference/documentation-gate.md)

## Evidence

- `MASSystem/Application/Facade/MASApplicationDiagnostics.vb`
- `MASSystem/Application/Facade/MASApplicationDiagnosticsSnapshot.vb`
- `MASSystem/Application/Facade/MASApplicationDiagnosticsFaultSummary.vb`
- `tools/docs/Invoke-NexamasUIDocumentationGate.ps1`
- `eng/tests/Run-NexamasUITestSuite.ps1`
- `eng/ci/Pack-Nexamas.UI.ps1`
- `eng/ci/Test-NexamasUIPackedConsumer.ps1`
