@@ -285,7 +285,6 @@ private ServiceCallSite CreateConstructorCallSite(
285285 }
286286
287287 parameterCallSites = CreateArgumentCallSites (
288- serviceType ,
289288 implementationType ,
290289 callSiteChain ,
291290 parameters ,
@@ -304,7 +303,6 @@ private ServiceCallSite CreateConstructorCallSite(
304303 ParameterInfo [ ] parameters = constructors [ i ] . GetParameters ( ) ;
305304
306305 ServiceCallSite [ ] currentParameterCallSites = CreateArgumentCallSites (
307- serviceType ,
308306 implementationType ,
309307 callSiteChain ,
310308 parameters ,
@@ -324,19 +322,24 @@ private ServiceCallSite CreateConstructorCallSite(
324322
325323 if ( bestConstructorParameterTypes == null )
326324 {
327- bestConstructorParameterTypes = new HashSet < Type > (
328- bestConstructor . GetParameters ( ) . Select ( p => p . ParameterType ) ) ;
325+ bestConstructorParameterTypes = new HashSet < Type > ( ) ;
326+ foreach ( ParameterInfo p in bestConstructor . GetParameters ( ) )
327+ {
328+ bestConstructorParameterTypes . Add ( p . ParameterType ) ;
329+ }
329330 }
330331
331- if ( ! bestConstructorParameterTypes . IsSupersetOf ( parameters . Select ( p => p . ParameterType ) ) )
332+ foreach ( ParameterInfo p in parameters )
332333 {
333- // Ambiguous match exception
334- string message = string . Join (
335- Environment . NewLine ,
336- SR . Format ( SR . AmbiguousConstructorException , implementationType ) ,
337- bestConstructor ,
338- constructors [ i ] ) ;
339- throw new InvalidOperationException ( message ) ;
334+ if ( ! bestConstructorParameterTypes . Contains ( p . ParameterType ) )
335+ {
336+ // Ambiguous match exception
337+ throw new InvalidOperationException ( string . Join (
338+ Environment . NewLine ,
339+ SR . Format ( SR . AmbiguousConstructorException , implementationType ) ,
340+ bestConstructor ,
341+ constructors [ i ] ) ) ;
342+ }
340343 }
341344 }
342345 }
@@ -360,7 +363,6 @@ private ServiceCallSite CreateConstructorCallSite(
360363 }
361364
362365 private ServiceCallSite [ ] CreateArgumentCallSites (
363- Type serviceType ,
364366 Type implementationType ,
365367 CallSiteChain callSiteChain ,
366368 ParameterInfo [ ] parameters ,
0 commit comments