Bug in ParametersToTypeList method of the BuilderStrategy class


I found a bug in the ParametersToTypeList method of the BuilderStrategy class. Inside the method it execute "parameter.GetType().Name". This does not take into account that "parameter" can be null, causing a exeception. This bug was exposed when I used a SCSF service with a constructor as follows:
MyService([ServiceDependency] IOtherService s1, [ServiceDependency(Required=false)] IAnotherService s2)
The second parameter is not required and can thus be null. These two parameters is eventually passed into the ParametersToTypeList function where the second entry in the array is null, causing the exception. The fix for the bug is as follows:
/// <summary>
/// Creates a trace list of parameter types from a list of <see cref="IParameter"/> objects.
/// </summary>
/// <param name="parameters">The parameters</param>
/// <returns>The type list in string form</returns>
protected string ParametersToTypeList(params object[] parameters)
List<string> types = new List<string>();
foreach (object parameter in parameters)
if (parameter != null)
return string.Join(", ", types.ToArray());


BradWilson wrote Dec 1, 2007 at 4:44 PM

This method isn't current used in OB 2, so I'm just going to remove it.

BradWilson wrote Dec 23, 2007 at 7:07 PM

Fixed in change set 29324