You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[dotnet] Server emits explicit nulls for optional event fields; strict clients reject them #2816
Strict clients (@ag-ui/[email protected], Zod-validated) reject the very first event:
ZodError: expected number, received null — path: ["timestamp"]
so the run fails client-side before any UI updates. curl-based testing never sees this (no validation), which makes it easy to ship a backend that looks healthy while all JS UIs fail instantly.
After this, events arrive clean and clients proceed. I note AGUIJsonUtilities.OmitPropertiesWithoutAValue already exists in the SDK — but hosts don't get null-omission by default, and MAF-added wrappers (rawEvent envelopes) reintroduce nulls anyway.
Suggestion
Omit null-valued optionals by default in the server event stream (the protocol marks these fields optional), rather than requiring every host to discover and configure this. At minimum, document it in the .NET hosting guidance.
The correct fix for this is to explicitly mark properties that are still required to be omitted by the protocol. The migration guide says "Event or message metadata: null and parentRunId: null remain invalid." therefore these two properties should be marked with [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] in the relevant classes within sdks/dotnet/src/AGUI.Abstractions/Generated/AGUIEvents.g.cs https://docs.ag-ui.com/concepts/agents#omit-whole-optional-null-fields
Activity
Kermittt commentedon Sep 29, 2026
The correct fix for this is to explicitly mark properties that are still required to be omitted by the protocol. The migration guide says "Event or message metadata: null and parentRunId: null remain invalid." therefore these two properties should be marked with
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]in the relevant classes withinsdks/dotnet/src/AGUI.Abstractions/Generated/AGUIEvents.g.cshttps://docs.ag-ui.com/concepts/agents#omit-whole-optional-null-fields
Kermittt commentedon Oct 1, 2026
Related... microsoft/agent-framework#7919
It's possible the fix should just be over in the
Microsoft.Agents.AI.Hosting.AGUI.AspNetCorepackage.