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

[BUG] Deserialization Cannot Handle Types which Implement IDisposable (JsonDocument) #727

Open
JCKortlang opened this issue Jul 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@JCKortlang
Copy link

JCKortlang commented Jul 23, 2024

What is the bug?

Deserialization Cannot Handle Types which Implement IDisposable (JsonDocument)

ObjectDisposedException: Cannot access a disposed object.
Object name: 'JsonDocument'.

How can one reproduce the bug?

using System.Text.Json.Nodes
var response =  await openSearchClient.SearchAsync<JsonDocument>(searchRequest);
return response.Hits.Select(hit => hit.Source.Id).ToList(); //Use the disposable object

What is the expected behavior?

I expect to be able to deserialize to standard .NET Json abstractions.
I expect to be able to deserialize to disposable values.

What is your host/environment?

MacOS 13.6.7 (22G720)

Do you have any screenshots?

No

Do you have any additional context?

I am attempting to deserialize a request to an index alias that contains multiple types. Since the Search interface does not support this, I need to deserialize the response to a more generic type. Ideally one of the standard and existing Json abstractions.

@JCKortlang JCKortlang added bug Something isn't working untriaged labels Jul 23, 2024
@Xtansia Xtansia removed the untriaged label Jul 23, 2024
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

2 participants