Conversation
…lizerOptions in CreateObjectInfo Co-authored-by: hientrung <6129457+hientrung@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix error occurring after deploying to server
Fix TypeInfoResolver error for generated params types when using source-generated JsonSerializerContext
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After deploying to server, calling source-generated CgScript wrapper methods throws
InvalidOperationException: TypeInfoResolver 'CgScriptSerializer' did not provide property metadata for type 'CgScriptExtensions+GetGridParams'— despite the README promising no[JsonSerializable]entries are needed for parameter types.Root Cause
WrapperEmitteremittedJsonMetadataServices.CreateObjectInfo<GetGridParams>(ctx.Options, ...), passing the user's source-generatedCgScriptSerializercontext options. In .NET 8+, configuring the resultingJsonTypeInfo<T>triggers aTypeInfoResolverlookup forGetGridParams. Since that internal params record is never registered withCgScriptSerializer, the lookup throws.Fix
The
SerializeHandlerlambda writes every property via hardcodedUtf8JsonWritercalls, soctx.Optionshas zero effect on the serialized output. The generatedCgScriptExtensionsclass now declares a shared static options field and uses it in place ofctx.Options:_cgScriptParamsSerializerOptionsuses theDefaultJsonTypeInfoResolver(reflection-based), which handles any type without pre-registration, so the resolver lookup never reachesCgScriptSerializerfor params types.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
www.antlr.org/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet /usr/share/dotnet/sdk/10.0.102/MSBuild.dll /noautoresponse /nologo /nodemode:1 /nodeReuse:true /low:false pport.Parsing/Catglobe.CgScript.EditorSupport.Parsing.csproj pport.CodeMirror.AspNet/Catglobe.CgScript.EditorSupport.CodeMirror.AspNet.csproj nt/Catglobe.CgScript.Deployment.csproj pport.SourceGenerator/Catglobe.CgScript.EditorSupport.SourceGenerator.csproj Catglobe.CgScript.Runtime.csproj ebApp/BlazorWebApp.csproj ebApp.Client/BlazorWebApp.Client.csproj pport.Lsp.Tests/Catglobe.CgScript.EditorSupport.Lsp.Tests.csproj pport.VsCode/Catglobe.CgScript.EditorSupport.VsCode.csproj pport.Lsp/Catglobe.CgScript.EditorSupport.Lsp.csproj pport.CodeMirror/Catglobe.CgScript.EditorSupport.CodeMirror.csproj atglobe.CgScript.Common.csproj pport.VisualStudio/Catglobe.CgScript.EditorSupport.VisualStudio.csproj(dns block)If you need me to access, download, or install something from one of these locations, you can either:
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.