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

Index.UpdateDocumentsAsync() got an exception about Reflection-based serialization has been disabled for this application #521

Open
wooly905 opened this issue Feb 5, 2024 · 2 comments

Comments

@wooly905
Copy link

wooly905 commented Feb 5, 2024

Description
When the app is set to "publish trimed" in csproj, System.Text.Json will disable reflection-based serialization.
<PublishTrimmed>true</PublishTrimmed>

In current meilisearch-dotnet source code, it uses System.Text.Json to serialize and deserialize. However, System.Text.Json doesn't support reflection-based serialization in above case. We will have an error message when UpdateDocumentsAsync() is invoked as shown in the screenshot below.

All functions (for example, Index, Task, Document and so on) talk to meilisearch server will fail.

Expected behavior
UpdateDocumentsAsync() should work properly.

Current behavior
UpdateDocumentsAsync() throws InvalidOperationException as shown in the screenshot.

Screenshots or Logs
image

Environment (please complete the following information):

  • OS: Windows 11 with .NET 8
  • Meilisearch version: 1.6
  • meilisearch-dotnet version: 0.14.7

**One possible solution: **
All functions talk to meilisearch api endpoints should provide new overloaded functions with a new parameter about JsonTypeInfo. So developers can decide what type to serialize and de-serialize as shown in the screenshot.

@curquiza
Copy link
Member

@ahmednfwela, if you are around, is it something you experienced or managed to reproduce?

I'm not a Dotnet user, so it's not trivial for me

@ahmednfwela
Copy link
Collaborator

yes, this specific issue requires changing the API to allow for users to take control of serialization and de-serialization

I am working on multiple PRs in .net/dart/flutter and this is the top priority right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants