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

EF7 Json column: constructor with optional enum-parameter throws ArgumentException #29214

Closed
alienwareone opened this issue Sep 27, 2022 · 2 comments · Fixed by #29227
Closed
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Milestone

Comments

@alienwareone
Copy link

I've attached a minimal repo that produces the exception.

https://github.com/alienwareone/EfCoreContructorBinding

@maumar
Copy link
Contributor

maumar commented Sep 27, 2022

Problem is in CreateExtractJsonPropertyExpression method and how we generate shaper code for nullable properties with converters defined on entities mapped to json.

maumar added a commit that referenced this issue Sep 28, 2022
#29214 - Json column: constructor with optional enum-parameter throws ArgumentException

When producing shaper code for json nullable properties with converters we check if the converter handles null, if not we need to peek into the json value and only pass it thru converter if it's not null, and return null otherwise

#29217 - Json: nullable enums on entities mapped to json don't use enum-to-int converter, rather than string, like for non-nullable enums

In convention code unwrap nullable type when testing for enum properties that we then apply converter to string

#29225 - Json: projecting nullable scalar produces debug.assert in SqlExpression ctor

Unwrap nullable type from property before passing it as type to SqlExpression ctor

Fixes #29214
Fixes #29217
Fixes #29225
@maumar maumar added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Sep 28, 2022
maumar added a commit that referenced this issue Sep 29, 2022
#29214 - Json column: constructor with optional enum-parameter throws ArgumentException

When producing shaper code for json nullable properties with converters we check if the converter handles null, if not we need to peek into the json value and only pass it thru converter if it's not null, and return null otherwise

#29217 - Json: nullable enums on entities mapped to json don't use enum-to-int converter, rather than string, like for non-nullable enums

In convention code unwrap nullable type when testing for enum properties that we then apply converter to string

#29225 - Json: projecting nullable scalar produces debug.assert in SqlExpression ctor

Unwrap nullable type from property before passing it as type to SqlExpression ctor

Fixes #29214
Fixes #29217
Fixes #29225
maumar added a commit that referenced this issue Sep 29, 2022
#29214 - Json column: constructor with optional enum-parameter throws ArgumentException

When producing shaper code for json nullable properties with converters we check if the converter handles null, if not we need to peek into the json value and only pass it thru converter if it's not null, and return null otherwise

#29217 - Json: nullable enums on entities mapped to json don't use enum-to-int converter, rather than string, like for non-nullable enums

In convention code unwrap nullable type when testing for enum properties that we then apply converter to string

#29225 - Json: projecting nullable scalar produces debug.assert in SqlExpression ctor

Unwrap nullable type from property before passing it as type to SqlExpression ctor

Fixes #29214
Fixes #29217
Fixes #29225
@ajcvickers ajcvickers added this to the 7.0.0 milestone Sep 30, 2022
maumar added a commit that referenced this issue Oct 1, 2022
#29214 - Json column: constructor with optional enum-parameter throws ArgumentException

When producing shaper code for json nullable properties with converters we check if the converter handles null, if not we need to peek into the json value and only pass it thru converter if it's not null, and return null otherwise

#29217 - Json: nullable enums on entities mapped to json don't use enum-to-int converter, rather than string, like for non-nullable enums

In convention code unwrap nullable type when testing for enum properties that we then apply converter to string

#29225 - Json: projecting nullable scalar produces debug.assert in SqlExpression ctor

Unwrap nullable type from property before passing it as type to SqlExpression ctor

#29219 - Json: error when trying to materialize json entity with nullable property that is missing in the json string - should materialize the property as null instead

Modify ExtractJsonProperty method so that it used TryGetProperty when trying to extract nullable properties.

Fixes #29214
Fixes #29217
Fixes #29225
Fixes #29219
maumar added a commit that referenced this issue Oct 1, 2022
#29214 - Json column: constructor with optional enum-parameter throws ArgumentException

When producing shaper code for json nullable properties with converters we check if the converter handles null, if not we need to peek into the json value and only pass it thru converter if it's not null, and return null otherwise

#29217 - Json: nullable enums on entities mapped to json don't use enum-to-int converter, rather than string, like for non-nullable enums

In convention code unwrap nullable type when testing for enum properties that we then apply converter to string

#29225 - Json: projecting nullable scalar produces debug.assert in SqlExpression ctor

Unwrap nullable type from property before passing it as type to SqlExpression ctor

#29219 - Json: error when trying to materialize json entity with nullable property that is missing in the json string - should materialize the property as null instead

Modify ExtractJsonProperty method so that it used TryGetProperty when trying to extract nullable properties.

Fixes #29214
Fixes #29217
Fixes #29225
Fixes #29219
maumar added a commit that referenced this issue Oct 3, 2022
#29214 - Json column: constructor with optional enum-parameter throws ArgumentException

When producing shaper code for json nullable properties with converters we check if the converter handles null, if not we need to peek into the json value and only pass it thru converter if it's not null, and return null otherwise

#29217 - Json: nullable enums on entities mapped to json don't use enum-to-int converter, rather than string, like for non-nullable enums

In convention code unwrap nullable type when testing for enum properties that we then apply converter to string

#29225 - Json: projecting nullable scalar produces debug.assert in SqlExpression ctor

Unwrap nullable type from property before passing it as type to SqlExpression ctor

#29219 - Json: error when trying to materialize json entity with nullable property that is missing in the json string - should materialize the property as null instead

Modify ExtractJsonProperty method so that it used TryGetProperty when trying to extract nullable properties.

Fixes #29214
Fixes #29217
Fixes #29225
Fixes #29219
maumar added a commit that referenced this issue Oct 4, 2022
#29214 - Json column: constructor with optional enum-parameter throws ArgumentException

When producing shaper code for json nullable properties with converters we check if the converter handles null, if not we need to peek into the json value and only pass it thru converter if it's not null, and return null otherwise

#29217 - Json: nullable enums on entities mapped to json don't use enum-to-int converter, rather than string, like for non-nullable enums

In convention code unwrap nullable type when testing for enum properties that we then apply converter to string

#29225 - Json: projecting nullable scalar produces debug.assert in SqlExpression ctor

Unwrap nullable type from property before passing it as type to SqlExpression ctor

#29219 - Json: error when trying to materialize json entity with nullable property that is missing in the json string - should materialize the property as null instead

Modify ExtractJsonProperty method so that it used TryGetProperty when trying to extract nullable properties.

Fixes #29214
Fixes #29217
Fixes #29225
Fixes #29219
@maumar
Copy link
Contributor

maumar commented Oct 4, 2022

fixed in d4c22b2

@maumar maumar closed this as completed Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants