Telling Configuration-binding source generator to ignore certain members #94651
Unanswered
jamescrosswell
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to modify some existing code so that this compiles with
<IsAotCompatible>true</IsAotCompatible>
. We have some "Options" classes that have a mix of some things that you might want to store in a config file like appsettings.json (primatives like bool, int, string) and some other stuff that you would definitely supply at runtime (e.g. callback methods).After enabling source genators (with
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
), unsurprisingly, I get a bunch of errors related to the type members that aren't designed to be read from config).A trivial example to reproduce the problem:
Is there a mechanism to tell the GeneratedConfigurationBinder to ingore certain members on the type being bound or is there some other way to solve this?
Beta Was this translation helpful? Give feedback.
All reactions