Core bug

Core bug

Old forum URL: forums.lhotka.net/forums/t/4081.aspx


rxelizondo posted on Saturday, December 22, 2007

Ok, it’s late and I am really, really tired right now so I hope I am not screwing up by labeling this a bug. I writing this now because I leave tomorrow for vacations and I am not sure when I will get the time to log this if not right now.


Ok, here is the deal. If you look at the “UndoableBase” class, there is a method called “GetFieldName”.  The method body contains the following instruction:


return field.DeclaringType.Name + "!" + field.Name;


The problem with this is that this really needs to be:


return field.DeclaringType.FullName + "!" + field.Name;


The reason why it needs to be “FullName” is because someone can create a custom class called “BusinessBase” (the same name as what the CSLA uses) and add a field to this custom class using the same field name as one of the persistent fields of the CSLA “BusinessBase” properties. For example:

-----
MyNameSpace
class BusinessBase
{
   private int EditLevel
}

-----


 If someone does this, when the CSLA tries to copy the state you will be getting a duplicate key exception when trying to insert the value in the “HybridDictionary” collection.

Of course, this problem is more likely to occur if the code is obfuscated since the obfuscation process will try to rename the classes as short as possible so the possibility having conflicting names it’s much bigger with obfuscated code.


Thanks (I am going to sleep!!)

rxelizondo replied on Thursday, January 10, 2008

Any comments on this anyone?

RockfordLhotka replied on Friday, January 11, 2008

This seems like a reasonable change, I'll try to fit it into 3.5.

Copyright (c) Marimer LLC