Menu

#2 Fix for late binding

open
nobody
None
5
2008-01-09
2008-01-09
No

In source file ObjectCreateRule.cs, there is a bug at line 103 in method OnBegin, for which the correction is as follows :

/// <summary>
/// Process the start of this element.
/// </summary>
public override void OnBegin()
{
// define a type of the object to create
Type realType = type;
if(attribute != null)
{
string val = digester.Attributes[attribute];
if(val != null)
{
realType = Type.GetType(val, true, true);
}
}

// create object instance
/object obj = Activator.CreateInstance(type); //Incorrect
object obj = Activator.CreateInstance(realType); //Correct
digester.Push(obj);
}

Discussion


Log in to post a comment.