@@ -232,8 +232,11 @@ internal static string ConstructorArgsString(Object[] constructorArgs)
232232 }
233233 return argsConstr ;
234234 }
235-
236235 static public void ExecuteVoidRef ( object o , string mthd , Object [ ] args )
236+ {
237+ ExecuteVoidRef ( o , mthd , args , null ) ;
238+ }
239+ internal static void ExecuteVoidRef ( object o , string mthd , Object [ ] args , string propertyName )
237240 {
238241 try
239242 {
@@ -279,7 +282,7 @@ static public void ExecuteVoidRef(object o, string mthd, Object[] args)
279282
280283 } catch ( MissingMethodException )
281284 {
282- throw new GxClassLoaderException ( BuildParameterMismatchErrorMessage ( mi . DeclaringType . FullName , pis , args ) ) ;
285+ throw new GxClassLoaderException ( BuildParameterMismatchErrorMessage ( mi . DeclaringType . FullName , pis , args , propertyName ) ) ;
283286 }
284287 }
285288 else
@@ -296,35 +299,38 @@ static public void ExecuteVoidRef(object o, string mthd, Object[] args)
296299 throw GxClassLoaderException . ProcessException ( e ) ;
297300 }
298301 }
299- static string BuildParameterMismatchErrorMessage ( string objectName , ParameterInfo [ ] methodParameters , object [ ] runtimeMethodParameters )
302+ static string BuildParameterMismatchErrorMessage ( string objectName , ParameterInfo [ ] methodParameters , object [ ] runtimeMethodParameters , string propertyName )
300303 {
301304 string parmInfo = GetParameterTypesString ( methodParameters ) ;
302305 string runtimeParms = GetParameterValuesString ( runtimeMethodParameters ) ;
303306 StringBuilder errorMessage = new StringBuilder ( ) ;
304- if ( methodParameters . Length == 0 )
307+
308+ errorMessage . Append ( $ "Program { objectName } ") ;
309+ if ( ! string . IsNullOrEmpty ( propertyName ) )
305310 {
306- errorMessage . Append ( $ "The object { objectName } does not have any parameters, thus it does not match the ") ;
311+ errorMessage . Append ( $ "referenced in { propertyName } property ") ;
307312 }
308- else if ( methodParameters . Length == 1 )
313+ errorMessage . Append ( $ "does not have the expected parameter definition.") ;
314+ if ( methodParameters . Length == 0 )
309315 {
310- errorMessage . Append ( $ "The parm rule of { objectName } with parameter: { parmInfo } does not match the ") ;
316+ errorMessage . Append ( $ "It does not have any parameters. ") ;
311317 }
312- else
318+ else
313319 {
314- errorMessage . Append ( $ "The parm rule of { objectName } with parameters : { parmInfo } does not match the ") ;
320+ errorMessage . Append ( $ "Program parameter definition : { parmInfo } . ") ;
315321 }
316322
317323 if ( runtimeMethodParameters . Length == 0 )
318324 {
319- errorMessage . Append ( $ "absence of values provided at runtime. ") ;
325+ errorMessage . Append ( $ "No parameter values were provided at runtime. ") ;
320326 }
321327 else if ( runtimeMethodParameters . Length == 1 )
322328 {
323- errorMessage . Append ( $ "value provided in runtime: { runtimeParms } . ") ;
329+ errorMessage . Append ( $ "Parameter value provided at runtime: { runtimeParms } . ") ;
324330 }
325331 else
326332 {
327- errorMessage . Append ( $ "values provided in runtime: { runtimeParms } . ") ;
333+ errorMessage . Append ( $ "Parameter values provided at runtime: { runtimeParms } . ") ;
328334 }
329335 errorMessage . Append ( $ "Please check the parm rule of the { objectName } .") ;
330336
0 commit comments