question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'JsonNumberHandlingAttribute' is only valid on a number or a collection of numbers when applied to a property or field.

See original GitHub issue

Describe the bug ‘JsonNumberHandlingAttribute’ is only valid on a number or a collection of numbers when applied to a property or field.

To Reproduce Steps to reproduce the behavior: 1.QdrantVectorDbClient.cs Line-132

public async Task<QdrantVectorRecord?> GetVectorByPayloadIdAsync(...)
{
       ... 
       // Line-132
       var data = JsonSerializer.Deserialize<SearchVectorsResponse>(responseContent);
       ...
}

Expected behavior ‘JsonNumberHandlingAttribute’ is only valid on a number or a collection of numbers when applied to a property or field. See member ‘Id’ on type ‘Microsoft.SemanticKernel.Connectors.Memory.Qdrant.Http.ApiSchema.SearchVectorsResponse+ScoredPoint’.

Screenshots If applicable, add screenshots to help explain your problem.

1

1

Issue Analytics

  • State:closed
  • Created 4 months ago
  • Reactions:2
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
SOE-YoungScommented, Jun 5, 2023

This issue seems to still be occurring in “0.15.230531.5-preview”. I’ve just updated to the latest release & with no other code changes, have just run into this issue.

Id was previously set using strings in our vector db.

IE: We’re looping though a JSON list of QnA items and saving them into a collection. The filename in our case, is named to represent the team / process the QnA list targets.

await _memory.SaveInformationAsync("QnACollection", qnaItem, $"{file.Name}-q{i}");

Not sure if we need to change anything here, but my understanding of QDrant is that a string value or an int should be accepted.

2reactions
craigomaticcommented, May 20, 2023

Sorry about this, we brought in a PR last week that was supposed to allow both numbers and strings for that property (Qdrant allows this) and it appears to have caused a regression.

To unblock yourself, you can remove the JsonNumberHandling attribute from ScoredPoint:

image

We will take another pass at fixing this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

JsonNumberHandlingAttribute on non-number collection ...
NET 6 breaking change where JsonNumberHandlingAttribute can now only be applied to properties that are collections of numbers.
Read more >
System.Text.Json: Deserialize JSON with automatic casting
The current implementation throws System.InvalidCastException: Unable to cast object of type 'System.Collections.Generic.List 1[System.String]' ...
Read more >
JsonNumberHandlingAttribute Class (System.Text.Json. ...
When placed on a type, property, or field, indicates what JsonNumberHandling settings should be used when serializing or deserializing numbers.
Read more >
Viewing online file analysis results for 'main.exe'
'JsonNumberHandlingAttribute' is only valid on a number or a collection of numbers when applied to a property or field.
Read more >
C# serialization with JsonSchema and System.Text.Json
Learn how code generation can build on System.Text.Json and JSON Schema to create a great experience for C# developers.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found