Skip to main content

.NET Debugging and Observability

Install the generated Debug Assist's SafeSqlEvidenceSink as the trusted IDiagnosticSqlLogSink. It retains a bounded, value-free projection while the wrapped text sink remains operator output.

var evidence = new SafeSqlEvidenceSink();
context.WithDiagnosticSqlLogSink(evidence);
context.EnableQuerySqlLog();
evidence.Clear();

var rows = await Q.Schools()
.Comment("Diagnose the school search")
.Purpose("Verify filters, facets, and relation loading")
.ExecuteForListAsync(context);

IReadOnlyList<SafeSqlEvidence> safe = evidence.Snapshot();

Use EnableQuerySqlLog(), DisableQuerySqlLog(), EnableMutationSqlLog(), and DisableMutationSqlLog() independently. Passing null to WithDiagnosticSqlLogSink removes operator output. DebugQuery must never enter HTTP responses or ordinary telemetry.

Run the Facet, aggregate, deep relation, Top-N, and audited save examples from .NET advanced data operations. Compare typed trace, parameterized SQL, duration, result/affected counts, and aliases while preserving native validation, conflict, and provider failures.

Install telemetry with context.WithRuntimeTelemetry(telemetry). Raw provider audit is independent from the safe IAppAuditEventSink. The current IRequestPolicy applies to queries; mutation tenant authorization must also be enforced and tested at the application/provider/TFP boundary.

Finish with the shared checklist.