C
C#2mo ago
Staledonut

JsonSerializerContext Editor Issues for AOT Compiling.

So I have set up a JsonSerializerContext that compiles correctly in AOT but in all files using the JsonContext it keeps telling me that "Default" does not exist. i checked the generated files in the obj folder and they exist. i tried cleaning out the compiled folders and restarting the editor. but the errors persist from roslyn. DonutEngine is the project that has the JsonSerializerContext file in it.
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WarningsAsErrors>$(WarningsAsErrors);IL2026;IL2075;IL3000;IL3050</WarningsAsErrors>

</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../DonutEngine.SourceGenerator/DonutEngine.SourceGenerator.csproj"
ReferenceOutputAssembly="false"
OutputItemType="Analyzer" />
<ProjectReference Include="../Saket.Particles/Saket.Particles.csproj" />
</ItemGroup>

<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)Generated</CompilerGeneratedFilesOutputPath>
<AddCompilerGeneratedFilesToProject>true</AddCompilerGeneratedFilesToProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Raylib-cs" Version="7.0.1" />
</ItemGroup>

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

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WarningsAsErrors>$(WarningsAsErrors);IL2026;IL2075;IL3000;IL3050</WarningsAsErrors>

</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../DonutEngine.SourceGenerator/DonutEngine.SourceGenerator.csproj"
ReferenceOutputAssembly="false"
OutputItemType="Analyzer" />
<ProjectReference Include="../Saket.Particles/Saket.Particles.csproj" />
</ItemGroup>

<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)Generated</CompilerGeneratedFilesOutputPath>
<AddCompilerGeneratedFilesToProject>true</AddCompilerGeneratedFilesToProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Raylib-cs" Version="7.0.1" />
</ItemGroup>

</Project>
have i missed anything that needs to be added to the project for it to correctly identify the generated files for roslyn? i also attached the JsonContext file.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?