Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No compatible with NativeAOT. #243

Open
Nab0y opened this issue Oct 4, 2024 · 0 comments
Open

No compatible with NativeAOT. #243

Nab0y opened this issue Oct 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Nab0y
Copy link

Nab0y commented Oct 4, 2024

Service

OpenAI

Describe the bug

Starting from version OpenAI_2.0.0-beta.8, the library is no longer compatible with NativeAOT.

Steps to reproduce

  1. Create sample console application
  2. Insert example code from Example01_SimpleChat.cs
  3. Enable Native Compilation in project settings.
<PropertyGroup>
        <OutputType>Exe</OutputType>
       ...
        <PublishAot>true</PublishAot>
       ...
</PropertyGroup>
  1. Launch project, get error

System.InvalidOperationException: Reflection-based serialization has been disabled for this application. Either use the source generator APIs or explicitly configure the 'JsonSerializerOptions.TypeInfoResolver' property.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_JsonSerializerIsReflectionDisabled()
at System.Text.Json.JsonSerializerOptions.ConfigureForJsonSerializer()
at System.Text.Json.JsonSerializer.GetTypeInfo(JsonSerializerOptions options, Type inputType)
at System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(Object value, Type inputType, JsonSerializerOptions options)
at System.BinaryData.FromObjectAsJson[T](T jsonSerializable, JsonSerializerOptions options)
at OpenAI.ModelSerializationExtensions..cctor() in /home/nab0y/Projects/openai-dotnet/src/Generated/Internal/ModelSerializationExtensions.cs:line 18

Code snippets

No response

OS

linux, win, macOs

.NET version

8.0

Library version

Starting from version OpenAI_2.0.0-beta.8,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant