@@ -185,12 +185,14 @@ bool TryCallCtor(Type type, Dictionary<string, IConfigurationSection> suppliedAr
185
185
}
186
186
else
187
187
{
188
- return new { ci , args , isCallable = false , matches , stringMatches , suppliedNames } ;
188
+ return new { ci , args , isCallable = false , matches , stringMatches ,
189
+ usedArguments = suppliedNames } ;
189
190
}
190
191
}
191
192
}
192
193
193
- return new { ci , args , isCallable = true , matches , stringMatches , suppliedNames } ;
194
+ return new { ci , args , isCallable = true , matches , stringMatches ,
195
+ usedArguments = suppliedNames } ;
194
196
} )
195
197
. Where ( binding => binding . isCallable )
196
198
. OrderByDescending ( binding => binding . matches )
@@ -217,7 +219,11 @@ bool TryCallCtor(Type type, Dictionary<string, IConfigurationSection> suppliedAr
217
219
218
220
foreach ( var pi in type . GetProperties ( BindingFlags . Instance | BindingFlags . Public ) )
219
221
{
220
- if ( ! binding . suppliedNames . Contains ( pi . Name ) && suppliedArguments . TryGetValue ( pi . Name , out var section ) && pi . CanWrite )
222
+ if ( ! binding . usedArguments . Contains ( pi . Name ) &&
223
+ suppliedArguments . TryGetValue ( pi . Name , out var section )
224
+ && pi . CanWrite &&
225
+ // This avoids trying to call esoteric indexers and so on.
226
+ pi . GetSetMethod ( false ) ? . GetParameters ( ) . Length == 1 )
221
227
{
222
228
var propertyValue = FromSection ( section , _configurationAssemblies ) ;
223
229
try
0 commit comments