InvalidCastException

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey folks,

ive got the following problem:

i have a class "ClassA" that has a Collection
of "ClassB". Ive a Property for the Collection
so im able to design the Values using the Windows Forms Designer (VS2005).

But sometimes then i open the form in the designer i
get an "InvalidCastException ... dK.ClassA is not of type dK.ClassA."

Hope you understand my opinion!

Many thanks,
Dennis
 
Are both ClassA, and the instance of ClassB that you are desiging in the
same project?

If so, this is a VS.NET bug, that my company probably spent about 4 months
going back and forth with MS about. Basically, the problem is VS.NET
loading up a copy of the DLL you are workin on into memory. Then, when there
is a change or a recompile, it loads up the new copy - and gets confused.
With this bug, it also ends up deleting a whole bunch of designer generated
code.

If what I am describing is the case for you, then the only solution is to
move out the part you are designing out to a separate project. So have
ClassA and ClassB in their own project, and the form or whatever that is
using them in a different one.
 
wow many thanks!!!!!



Marina Levit said:
Are both ClassA, and the instance of ClassB that you are desiging in the
same project?

If so, this is a VS.NET bug, that my company probably spent about 4 months
going back and forth with MS about. Basically, the problem is VS.NET
loading up a copy of the DLL you are workin on into memory. Then, when there
is a change or a recompile, it loads up the new copy - and gets confused.
With this bug, it also ends up deleting a whole bunch of designer generated
code.

If what I am describing is the case for you, then the only solution is to
move out the part you are designing out to a separate project. So have
ClassA and ClassB in their own project, and the form or whatever that is
using them in a different one.
 
Back
Top