C
C#17mo 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
DavideOP17mo ago
phaseshift
phaseshift17mo ago
whats the appsettings config look like?
FestivalDelGelato
are members of Bot properties?
phaseshift
phaseshift17mo ago
No theyre fields - that's likely the issue. I don't think config/options binding work with fields?
FestivalDelGelato
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
Accord17mo 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.

Did you find this page helpful?