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

JsonConverterAttribute not working with source-gen when converter is internal type #81703

Closed
krwq opened this issue Feb 6, 2023 · 3 comments
Closed

Comments

@krwq
Copy link
Member

krwq commented Feb 6, 2023

Manifestation and description of this issue is here: #81702
Note: I opened two issues so that this is tracked by both areas

We should figure out what to do on the JSON side.

One of the options is to use Activator.CreateInstance somewhere but that seems a bit ugly and we should make sure we won't break trimmability with that.

@krwq krwq added this to the 8.0.0 milestone Feb 6, 2023
@ghost
Copy link

ghost commented Feb 6, 2023

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

Manifestation and description of this issue is here: #81702

We should figure out what to do on the JSON side.

One of the options is to use Activator.CreateInstance somewhere but that seems a bit ugly and we should make sure we won't break trimmability with that.

Author: krwq
Assignees: -
Labels:

area-System.Text.Json

Milestone: 8.0.0

@eerhardt
Copy link
Member

eerhardt commented Feb 6, 2023

and we should make sure we won't break trimmability with that.

The trimmer and AOT compiler can recognize certain Reflection patterns and make sure the types, and their constructors, are preserved correctly. Basically something like:

Activator.CreateInstance(Type.GetType("System.BinaryDataConverter, System.Memory.Data"))

should be recognized by the trimmer, not produce a warning, and preserve the type and ctor when trimming.

cc @vitek-karas @sbomer

@eiriktsarpalis
Copy link
Member

Closing in favor of #81702.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants