Skip to content

feat: source generator fail-safe (internal error diagnostics)#113

Merged
Skymly merged 1 commit into
mainfrom
feat/generator-fail-safe
Jul 7, 2026
Merged

feat: source generator fail-safe (internal error diagnostics)#113
Skymly merged 1 commit into
mainfrom
feat/generator-fail-safe

Conversation

@Skymly

@Skymly Skymly commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add shared GeneratorFailSafe helper with ExecuteParse and TryEmit to convert unexpected generator exceptions into compile-time diagnostics instead of crashing Roslyn.
  • Register per-domain internal error IDs: OBS2005, OBS3006, OBS4008, OBS5008, OBS6008, OBS7008, OBS8006, OBS9008.
  • Wrap parse/emit pipelines across all eight domains; consolidate emit fail-safe in domain IncrementalValuesProviderExtensions.
  • Fix Events OBS2005 message formatting for both parse and emit paths (MessageArg + MessageArg2).
  • Add SignalR regression tests (unit tests + IInternalErrorProbe integration hook active only for GeneratorTests assembly).
  • Mark ROADMAP P3-A E2 complete.

Closes #112

Companion docs PR: Skymly/Observables.Docs (internal error diagnostic tables).

Test plan

  • dotnet build Observables.slnx -c Release
  • dotnet test Observables.SignalR.R3.SourceGenerators.Tests --filter GeneratorFailSafeTests
  • dotnet test Observables.Events.R3.SourceGenerators.Tests
  • Nuke Test target (full manifest)

…iagnostics

Wrap parse and emit pipelines so unexpected generator exceptions report
OBS* internal error diagnostics instead of crashing compilation. Adds shared
GeneratorFailSafe helper, eight domain descriptors, SignalR regression tests,
and marks ROADMAP E2 complete.

Closes #112

@Skymly Skymly left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comment

Solid E2 delivery. The shared GeneratorFailSafe split (ExecuteParse vs TryEmit) keeps domain generators thin, and consolidating emit fail-safe in each shproj IncrementalValuesProviderExtensions is the right place for it.

Highlights

  • OperationCanceledException is rethrown on both paths — correct for incremental generators.
  • Per-domain internal error IDs avoid colliding with existing *007 analyzer slots.
  • Events MessageArg2 fix ensures OBS2005 reports type: message on both parse and emit paths.
  • SignalR coverage is practical: unit tests for the helper plus an IInternalErrorProbe hook scoped to the GeneratorTests assembly.

Merge notes

  • Companion docs PR: Observables.Docs#8 — merge after or together with this one.
  • On the next release that ships these diagnostics, remember to move the new rules from each domain AnalyzerReleases.Unshipped.md into Shipped.md.

Verified locally (pre-PR)

  • dotnet build Observables.slnx -c Release
  • GeneratorFailSafeTests (3/3)
  • Events R3 generator tests (16/16)
  • Nuke Test target green

@Skymly Skymly merged commit 7557ba7 into main Jul 7, 2026
20 checks passed
@Skymly Skymly deleted the feat/generator-fail-safe branch July 7, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add source generator fail-safe (internal error diagnostics)

1 participant