-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
services.Configure<SomeDictionaryOptions>(configuration) failure at PublishAot #75869
Comments
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsDescriptionII have an
Reproduction Stepsbinding testOptions to configuration
publish as jit print
publish aot print
Expected behavior
Actual behavior
Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
Configuration binding isn't trimmer/AOT friendly. Don't you get warnings when you publish AOT? |
There was a warning, but I don't know any way to solve the problem. |
Tagging subscribers to this area: @dotnet/area-extensions-configuration Issue DetailsDescriptionII have an
Reproduction Stepsbinding testOptions to configuration
publish as jit print
publish aot print
Expected behavior
Actual behavior
Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
Some of the warnings might be emanating from the fact you're calling into a You might also want to consider sharing a minimal reproduction of the issue you are experiencing (including inputs, expected behavior vs actual behavior -- I suppose the JSON you shared is serialization output for some input in the two configuration?). A minimal repro might help us provide you with more concrete recommendations. |
There may not be a workaround but please do share a runnable code sample (with the configuration). |
Using 7.0-rc1, the behavior I get is:
{"UserArray":[],"StringIntMap":{"one":1,"two":2},"StringUserMap":{}} The real solution here is:
However, in the meantime, if you really want to get this to work, add the following attributes to your [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(User))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(Dictionary<string, User>))] These attributes manually preserve all the members on the listed types. The allows the binding code to work, since the members are not trimmed. Since the current behavior is by design (you are getting warnings saying that the |
Description
II have an
TestOptions
type that works well under JIT, but theStringUserMap
property is not work after PublishAOT, the code is as followsReproduction Steps
binding testOptions to configuration
publish as jit print
publish aot print
Expected behavior
StringUserMap
property binding work at PublishAOTActual behavior
StringUserMap
property binding is not work at PublishAOTRegression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: