CSLA 3.6 cannot have private member with identical name as inherited private member

CSLA 3.6 cannot have private member with identical name as inherited private member

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


Michael posted on Wednesday, April 08, 2009

I have just updated to 3.6. I have a bunch of classes inheriting from my own generic base class. The generic class and the concrete classes have their own private byte[] m_lastChanged. This is now throwing:

System.ArgumentException was unhandled by user code
  Message="Item has already been added. Key in dictionary: 'm_lastChanged'  Key being added: 'm_lastChanged'"

Renaming the member in the base class fixes the problem. Does this mean every private member variable name must be unique all the way up the inheritance tree?

RockfordLhotka replied on Wednesday, April 08, 2009

What is throwing this exception? N-level undo, serialization, validation?

Michael replied on Wednesday, April 08, 2009

CopyState(int parentEditLevel) in UndoableBase at the call to state.Add(h.MemberName, value);

RockfordLhotka replied on Thursday, April 09, 2009

That looks like a bug to me. I'm trying to trace the history of that change, but it appears that it occurred when we switched from reflection to dynamic method invocation, and somehow the full path name of the field is no longer used in the state dictionary.

RockfordLhotka replied on Thursday, April 09, 2009

I believe the issue is resolved. If you can, please grab the Csla.Core.UndoableBase and Csla.Reflection.DynamicMemberHandle classes from svn and see if it solves your problem.

You can click the 'svn revisions' link off the bug to see the code and changes:

http://www.lhotka.net/cslabugs/edit_bug.aspx?id=385

 

Copyright (c) Marimer LLC