© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
11 replies
Core

Is there a method that throws an exception if a config value is not present in appsettings?

Hello,
Getting configuration values from
appsettings.json
appsettings.json
is done via calling
builder.Configuration["name"]
builder.Configuration["name"]
. This way few of my services might get a null property, without throwing error before build.

Is there an existing method that will throw an exception if the config value is
null
null
?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Check if value is within range, throw exception if not
C#CC# / help
16mo ago
✅ async Task throws exception if not explicitly defined
C#CC# / help
3y ago
✅ Is throwing and catching an exception in an UnmanagedCallersOnly method valid?
C#CC# / help
9mo ago
✅ JSON serializing Optional type throws an exception(?)
C#CC# / help
3y ago