Skip to content

Commit 7b18eef

Browse files
committed
added exception
1 parent 62acc84 commit 7b18eef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Serilog.Settings.Configuration/Settings/Configuration/ConfigurationReader.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ internal ILookup<string, Dictionary<string, IConfigurationArgumentValue>> GetMet
221221
IConfigurationArgumentValue GetArgumentValue(IConfigurationSection argumentSection)
222222
{
223223
IConfigurationArgumentValue argumentValue;
224+
225+
if(argumentSection.Value != null && argumentSection.GetChildren().Any())
226+
throw new InvalidOperationException($"Combined configuration sources must result in a discrete value (string, int, etc.) or complex value (section, list, etc.), not both. Argument: {argumentSection.Path}");
227+
224228
if (argumentSection.Value != null)
225229
{
226230
argumentValue = new StringArgumentValue(() => argumentSection.Value, argumentSection.GetReloadToken);

0 commit comments

Comments
 (0)