Skip to content

Missing JSON Converter Definition #183

@buttercat1791

Description

@buttercat1791

I am getting the following error on dotnet build:

{projectPath}\obj\Debug\net9.0\browser-wasm\System.Text.Json.SourceGeneration\System.Text.Json.SourceGeneration.JsonSourceGenerator\SerializerContext.XBA61F72A.g.cs(29,203): error CS0117: 'JsonMetadataServices' does not contain a definition for 'XBA61F72AConverter'

Searching the /obj directory for XBA61F72A revealed the following SerializerContext definition in a Serializer.g.cs file:

using System.Text.Json.Serialization;

namespace Bootsharp.Generated;

[JsonSerializable(typeof(global::System.Object), TypeInfoPropertyName = "XBA61F72A")]
[JsonSerializable(typeof(global::System.Object[]), TypeInfoPropertyName = "XA9C0E00C")]
[JsonSerializable(typeof(global::System.Func<global::CoxAuto.CarQL.Net.Client.JS.Interfaces.ICarqlJsQueryBuilder, global::CoxAuto.CarQL.Net.Client.JS.Interfaces.ICarqlJsQueryBuilder>), TypeInfoPropertyName = "X1CF1CE5")]
[JsonSerializable(typeof(global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object>), TypeInfoPropertyName = "X368AC899")]
[JsonSourceGenerationOptions(
    PropertyNameCaseInsensitive = true,
    PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,
    DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
)]
internal partial class SerializerContext : JsonSerializerContext;

I have some functions in my codebase that are intended to be callable from JS that use object or Func as parameters or return types. Here are some examples:

void Filter(string field, string op, object value);
void Union(Func<ICarqlJsQueryBuilder, ICarqlJsQueryBuilder> filter);
Task<object[]> GetPage(int page);

As additional context, here is my project configuration:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net9.0</TargetFramework>
    <RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
    <BootsharpName>my-project</BootsharpName>
    <BootsharpEmbedBinaries>false</BootsharpEmbedBinaries>
    <BootsharpAggressiveTrimming>true</BootsharpAggressiveTrimming>
    <BootsharpOptimize>size</BootsharpOptimize>
    <BootsharpLLVM>true</BootsharpLLVM>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Bootsharp" Version="0.6.3" />
    <PackageReference Include="Bootsharp.Inject" Version="0.6.3" />
    <PackageReference Include="Microsoft.JSInterop" Version="9.0.6" />
  </ItemGroup>

  <!-- Other dependencies -->

</Project>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions