@@ -169,7 +169,8 @@ private IEnumerable<Expression> CreateNewBuildupSequence(DynamicBuildPlanGenerat
169
169
yield return Expression . Call ( null ,
170
170
SetCurrentOperationToInvokingConstructorMethod ,
171
171
Expression . Constant ( signature ) ,
172
- buildContext . ContextParameter ) ;
172
+ buildContext . ContextParameter ,
173
+ Expression . Constant ( selectedConstructor . Constructor . DeclaringType ) ) ;
173
174
174
175
yield return Expression . Assign (
175
176
buildContext . GetExistingObjectExpression ( ) ,
@@ -194,7 +195,8 @@ private IEnumerable<Expression> BuildConstructionParameterExpressions(DynamicBui
194
195
SetCurrentOperationToResolvingParameterMethod ,
195
196
Expression . Constant ( constructionParameters [ i ] . Name , typeof ( string ) ) ,
196
197
Expression . Constant ( constructorSignature ) ,
197
- buildContext . ContextParameter ) ) ;
198
+ buildContext . ContextParameter ,
199
+ Expression . Constant ( selectedConstructor . Constructor . DeclaringType ) ) ) ;
198
200
i ++ ;
199
201
}
200
202
}
@@ -258,19 +260,17 @@ private static void GuardTypeIsNonPrimitive(IBuilderContext context)
258
260
/// <summary>
259
261
/// A helper method used by the generated IL to store the current operation in the build context.
260
262
/// </summary>
261
- public static void SetCurrentOperationToResolvingParameter ( string parameterName , string constructorSignature , IBuilderContext context )
263
+ public static void SetCurrentOperationToResolvingParameter ( string parameterName , string constructorSignature , IBuilderContext context , Type type )
262
264
{
263
- ( context ?? throw new ArgumentNullException ( nameof ( context ) ) ) . CurrentOperation = new ConstructorArgumentResolveOperation (
264
- context . BuildKey . Type , constructorSignature , parameterName ) ;
265
+ context . CurrentOperation = new ConstructorArgumentResolveOperation ( type , constructorSignature , parameterName ) ;
265
266
}
266
267
267
268
/// <summary>
268
269
/// A helper method used by the generated IL to store the current operation in the build context.
269
270
/// </summary>
270
- public static void SetCurrentOperationToInvokingConstructor ( string constructorSignature , IBuilderContext context )
271
+ public static void SetCurrentOperationToInvokingConstructor ( string constructorSignature , IBuilderContext context , Type type )
271
272
{
272
- ( context ?? throw new ArgumentNullException ( nameof ( context ) ) ) . CurrentOperation = new InvokingConstructorOperation (
273
- context . BuildKey . Type , constructorSignature ) ;
273
+ context . CurrentOperation = new InvokingConstructorOperation ( type , constructorSignature ) ;
274
274
}
275
275
276
276
/// <summary>
0 commit comments