Using the Visual Studio Constructor - "Object Link Not Installed on Object Instance" (Visual Studio 2008)

I recently dropped some C # code to make some minor cosmetic changes. When I open some of the files in Visual Studio, I get errors saying:

To prevent possible data loss ...

The first of these errors:

The reference to the object is not installed in the instance of the object.

I can follow the stack trace, but I'm not sure what I really should look for in this situation. Also, the end of my stack trace has a call that ends in "PageScroller..ctor ()".

Based on a little Google research, I guess this means calling the constructor. It's true?

+5
source share
3 answers

You have a design-mode error for some custom control, probably PageScroller, and apparently starting with the constructor. Perhaps there is some code in the constructor that returns null in design mode, but zero is not checked.

+4
source

Sometimes I see such problems. I started moving code from the constructor to the load event, and that helped.

+2
source

,

InitializeComponent();

, .

0

All Articles