Skip to content

[R25] Reject unsupported collection symbols without analyzer crashes - #30

Open
JetF0x wants to merge 1 commit into
Carsillas:rewritefrom
JetF0x:fix/review-r25
Open

JetF0x wants to merge 1 commit into
Carsillas:rewritefrom
JetF0x:fix/review-r25

Conversation

@JetF0x

@JetF0x JetF0x commented Sep 12, 2026

Copy link
Copy Markdown

Addresses review finding R25.

Collection declarations such as NetworkList<int[]>, NetworkDictionary<int, int[]>, and NetworkList<T> caused AD0001 because the analyzer cast arbitrary element symbols to INamedTypeSymbol. The array declarations could otherwise compile successfully and reach an unsupported runtime codec. Guard the network-object inheritance check with named-symbol matching so unsupported symbol kinds return the existing CN0015 error at the collection property instead of crashing the analyzer.

Add 26 analyzer cases covering arrays, dynamic values, type parameters and constraints, nested array/generic struct fields, dictionary keys, and simultaneous invalid keys and values. Add 14 combined generator/analyzer cases confirming that unsupported array schemas are rejected even when generated C# compiles, and that scalar, string, Guid, network-object, public-field struct, and nullable collections still analyze and emit successfully. The generator test project references the analyzer to run these combined checks.

Validation on .NET SDK 10.0.400 / net8.0:

  • Before the production fix, 13 new cases failed with AD0001 and 27 controls passed.
  • All 40 focused cases pass with the fix.
  • The complete Release solution test run passes all 268 tests: 155 runtime, 79 analyzer, and 34 generator.
  • The final focused run after test-source whitespace cleanup passes all 40 cases; the committed diff passes the whitespace check.

The change preserves supported collection types, existing CN0016 key validation, runtime behavior, public APIs, and wire formats. Previously accepted unsupported element symbols now correctly produce an analyzer error. No diagnostics are added or renumbered.

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.

1 participant