(Can\'t believe this hasn\'t already been asked, but I can\'t find a dup)
In Visual Studio with lots of projects, when I first open the solution, I sometime
If you have a user control that exposes an object with a getter/setter, you are going to have a bad time (as they say). It is, in fact, the setter that is the problem.
SO to fix it, instead of doing this:
public ObjectX
{
get { return _objx; }
set
{
_objx=value;
//do some other stuff
}
}
You could do something along the lines of this:
public ObjectX
{
get { return _objx; }
}
public void SetObjectX(ObjectX inVal)
{
_objx = inVal;
//do some other stuff
}
... which will prevent the Visual Designer from trying to assign a serialized version of ObjectX to your control at design time, which is really what was going on ...