Repository navigation
Description
dotnet run tools/oracles.cs status lists two unheld claims, both from docs/serialization.md#native-aot:
- A02 — under Native AOT,
JsonSerializer.Serialize(value)with default options throwsInvalidOperationExceptionfor a range, a variant, aRangeSetand a value set, typed or throughobject. - A03 — a
RangeSet<TRange, T>or wrapper set the program never constructs still deserializes through its attribute converter; if trimming removed the registration, the lookup throwsNotSupportedExceptionnaming the type.
Today only test/consumer-smoke-test.sh observes them (aot-default-options, aot-rangeset-read, aot-noda-rangeset-read, aot-wrapper-read), and heldBy can only name a test class (OracleCatalogueTests), so the catalogue can't point at the script.
What can hold them short of a Native AOT publish
Most of A02 and A03 is about System.Text.Json with reflection turned off, not about AOT compilation itself. PublishAot flips the feature switch System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault to false; that switch can be set in an ordinary JIT process. Measured on main (7f4dc47) in a console app with <JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>:
IsReflectionEnabledByDefault = False
range: InvalidOperationException variant: InvalidOperationException
rangeset: InvalidOperationException stringset: InvalidOperationException
object-range: InvalidOperationException object-set: InvalidOperationException
rangeset-read: {[1,5],[7,10]} (RangeSet<Int64Range, long>, never constructed, via a JsonSerializerContext)
wrapper-read: {1,2} (Int32Set<Code>, never constructed)
stringset-wrapper-read: {a,b} (StringSet<Key>, never constructed)
That is exactly the smoke test's aot-default-options row and the three *-read rows, reproduced without an AOT publish.
The switch is per process, as Npgsql.DisableDateTimeInfinityConversions is, so it needs its own test project — the same shape as test/CodoMetis.ValueRanges.EFCore.PostgreSQL.InfinityDisabled.IntegrationTests: a RuntimeHostConfigurationOption for System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault = false, a TheSwitch_IsInEffect check, and one test class (say ReflectionDisabledJsonTests) that heldBy can name for A02 and A03. No Docker needed.
What stays with the smoke test
- Whether the registration code was compiled into the binary. Under the JIT every instantiation exists on demand, so "a type the program only deserializes" is not a distinct case there. Only the Native AOT consumer answers that, and
GenericConverterssays so in its remarks. - The trimming half of A03 (
NotSupportedExceptionnaming the type when the registration is gone). It is reachable in a unit test only throughGenericConverters.Get(typeof(X))for a type that never registers, and that class is internal withInternalsVisibleTofor the NodaTime satellite only. Either widenInternalsVisibleToto the test project and assert the exception's message names the type, or leave this half to the smoke test and say so in the claim.
Proposal: add the project, point A02 and A03 at it, and extend docs/oracles.md#what-it-does-not-see to say which part of the AOT promise it still can't see. Found in the 10.0.0 bug hunt; tests only, no library change.
Activity