You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When binding a configuration which contains an Enum type it fails silently if the enum is not well defined. In general, if the binding fails it will just fail silently and that part of the configuration is not binded and proceed. I want to catch this errors to prevent runtime errors due to misconfigurations.
Is it possible to catch that error or add validation logic somewhere?, or, is it possible to allow control of whether to fail silently or not?
The silent pass happens here and in other places (depending on the collection type you're binding).
Lets say I have the following json configuration file:
public class MyConfiguration
{
public IList<Color> Config { get; set }
}
Where Color is an enum defined somewhere:
public Enum
{
Red,
Green,
Blue,
}
If I set "Dog" the enum parse will fail and thus that section of the config will be ignored. I would rather catch that error and let know the user his/her configuration is not well defined.
The text was updated successfully, but these errors were encountered:
When binding a configuration which contains an Enum type it fails silently if the enum is not well defined. In general, if the binding fails it will just fail silently and that part of the configuration is not binded and proceed. I want to catch this errors to prevent runtime errors due to misconfigurations.
Is it possible to catch that error or add validation logic somewhere?, or, is it possible to allow control of whether to fail silently or not?
The silent pass happens here and in other places (depending on the collection type you're binding).
Lets say I have the following json configuration file:
And I'm trying to bind it to the following class:
Where Color is an enum defined somewhere:
If I set "Dog" the enum parse will fail and thus that section of the config will be ignored. I would rather catch that error and let know the user his/her configuration is not well defined.
The text was updated successfully, but these errors were encountered: