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

System.Text.Json GetConverterFromAttribute need to be annotated for native aot #68878

Closed
LakshanF opened this issue May 4, 2022 · 2 comments · Fixed by #71746
Closed

System.Text.Json GetConverterFromAttribute need to be annotated for native aot #68878

LakshanF opened this issue May 4, 2022 · 2 comments · Fixed by #71746
Assignees
Milestone

Comments

@LakshanF
Copy link
Member

LakshanF commented May 4, 2022

The above method in JsonSerializerOptions has a suppression currently until converter code that calls this method is refactored to distinguish between reflection and source generated paths. The suppression is there so as to make forward progress on the effort to annotate this library and get the PR #68464 merged but it is dangerous since some reflection code paths will go through this method.

The conversation in the PR has more details.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label May 4, 2022
@ghost
Copy link

ghost commented May 4, 2022

Tagging subscribers to this area: @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

Issue Details

The above method in JsonSerializerOptions has a suppression currently until converter code that calls this method is refactored to distinguish between reflection and source generated paths. The suppression is there so as to make forward progress on the effort to annotate this library and get the PR #68464 merged but it is dangerous since some reflection code paths will go through this method.

The conversation in the PR has more details.

Author: LakshanF
Assignees: -
Labels:

area-System.Reflection, untriaged

Milestone: -

@ghost
Copy link

ghost commented May 5, 2022

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

The above method in JsonSerializerOptions has a suppression currently until converter code that calls this method is refactored to distinguish between reflection and source generated paths. The suppression is there so as to make forward progress on the effort to annotate this library and get the PR #68464 merged but it is dangerous since some reflection code paths will go through this method.

The conversation in the PR has more details.

Author: LakshanF
Assignees: -
Labels:

area-System.Reflection, area-System.Text.Json, untriaged

Milestone: -

@layomia layomia removed the untriaged New issue has not been triaged by the area owner label May 9, 2022
@layomia layomia added this to the 7.0.0 milestone May 9, 2022
@layomia layomia self-assigned this May 9, 2022
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label May 18, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jun 24, 2022
eiriktsarpalis added a commit to eiriktsarpalis/runtime that referenced this issue Jul 7, 2022
…t#71714

Include JsonSerializerContext in JsonSerializerOptions copy constructor. Fix dotnet#71716

Move reflection-based converter resolution out of JsonSerializerOptions. Fix dotnet#68878
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 7, 2022
eiriktsarpalis added a commit that referenced this issue Jul 7, 2022
* Remove implicit fallback to reflection-based serialization. Fix #71714

Include JsonSerializerContext in JsonSerializerOptions copy constructor. Fix #71716

Move reflection-based converter resolution out of JsonSerializerOptions. Fix #68878

* Address feedback & add one more test

* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerContext.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>

* fix build

* Bring back throwing behavior in JsonSerializerContext and add tests

* Only create caching contexts if a resolver is populated

* Add null test for JsonSerializerContext interface implementation.

* skip RemoteExecutor test in netfx targets

* Add DefaultJsonTypeInfoResolver test for types with JsonConverterAttribute

* remove nullability annotation

* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Converters.cs

Co-authored-by: Krzysztof Wicher <mordotymoja@gmail.com>

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Krzysztof Wicher <mordotymoja@gmail.com>
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 7, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.