Repository navigation
Commit 501cc6f
.NET: Fix AG-UI SSE events written with explicit nulls (microsoft#7920)
* .NET: Fix AG-UI SSE events written with explicit nulls (microsoft#7919)
ConfigureAGUIJsonOptions appended its resolvers to the ASP.NET Core
TypeInfoResolverChain, which already has a reflection-based resolver at
its head. Both appended resolvers were therefore unreachable for every
type reflection can handle, so the AG-UI wire-format rules never applied.
This was invisible with AGUI 0.0.5, whose omit-empty rule rides on
attributes the reflection resolver honors. AGUI 0.0.6 moved that rule to
a type-info modifier on AGUIJsonUtilities.DefaultTypeInfoResolver, which
only applies when that resolver is actually consulted. Bumping the pin
without fixing the ordering makes every SSE event go out with explicit
nulls for its optional fields ("parentRunId": null and similar), which
@ag-ui/client rejects with a ZodError.
Insert both resolvers ahead of the reflection resolver and compose
AGUIJsonUtilities.DefaultTypeInfoResolver rather than the context
directly, as the AGUI docs direct. The AGUI pin moves to 0.0.6 in the
same change since DefaultTypeInfoResolver is new in that version.
Adds a regression test asserting the serialized event carries no explicit
nulls; it fails against the previous ordering.
* .NET: Use xUnit assertions in AG-UI JSON regression test
---------
Co-authored-by: westey <[email protected]>1 parent 9127b89 commit 501cc6f
2 files changed
Lines changed: 26 additions & 6 deletions
File tree
- dotnet
- src/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore
- tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
35 | 48 | | |
36 | 49 | | |
37 | 50 | | |
| |||
0 commit comments