C
C#16mo ago
Davide

❔ IOptions pattern in WebAPI getting null value

I'm trying to use the IOptions pattern with Dep. Injection, however when i debug the code i get null values in the injected object. I've tried to use the .AddOptions() method to the builder ServiceCollection but still i get null values
6 Replies
Davide
DavideOP16mo ago
phaseshift
phaseshift16mo ago
whats the appsettings config look like?
Omnissiah
Omnissiah16mo ago
are members of Bot properties?
phaseshift
phaseshift16mo ago
No theyre fields - that's likely the issue. I don't think config/options binding work with fields?
Omnissiah
Omnissiah16mo ago
oops i didn't see the image it doesn't maybe there's a specific setting to enable it, but it's unusual and not recommended
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server