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

CustomLinqSerializer silently adds Enum to string processing on serialization but fails on deserialization #4890

Open
oragain opened this issue Nov 14, 2024 · 0 comments
Labels
customer-reported Issue created by a customer needs-investigation

Comments

@oragain
Copy link

oragain commented Nov 14, 2024

Describe the bug

Bug 1:
When using a custom CosmosLinqSerializer, if an object contains an enumeration property that does have the [JsonConverter(typeof(JsonStringEnumConverter))] attribute, the serializer will stringify the enum properly, but fail to retrieve the document when doing a linq query (GetItemLinqQueryable) on said property.

Bug 2: (not sure if this one is a bug or just the way the cosmos db sdk works normally)
When not using a custom serializer, the [JsonConverter(typeof(JsonStringEnumConverter))] attribute is ignored.

To Reproduce
See code sample:
CosmosDBSDKTests.zip

sorry for the number of files, but I was making sure my polymorphism was working at the same time.

Expected behavior
Bug 1:
Expect the GetItemLinqQueryable to retrieve the document

Bug 2:
That when no custom serializer are provided, actually respect the attribute?

Actual behavior
The document is not retrieved

Environment summary
SDK Version: 3.44 and 3.45
OS Version: Windows
IDE: Visual Studio 2022 preview 5

Additional context
Weirdly enough:

  • if [JsonConverter(typeof(JsonStringEnumConverter))] is set on the enum itself instead of the property of the complex object, the custom CosmosLinqSerializer works as intended without the need to add the JsonStringEnumConverter.
  • Adding the JsonStringEnumConverter to the list of converters make everything work too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issue created by a customer needs-investigation
Projects
None yet
Development

No branches or pull requests

1 participant