Re: Once again - Object of type x...
Chris Anderson <[email protected]> Mon, 18 Dec 2006 20:21:19 -0000
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <[email protected]> |
> > It's probably compiling your code for design-time use and > > trying to pass one build version of GraphConfiguration to an > > "older" function that accepts and "older" build of > > GraphConfiguration (or vice versa). > > This I don't understand. Since the classes and user controls are all > in the > same 'project', where would it be getting this old information from? > The > last time it was built successfully? Some of it yeah, but the IDE may also have instances from earlier builds (and may try to do partial in-memory builds - I don't know) You may be able to get around the problem by simply closing all the designers that the controls are on whenever you do a build..this will allow the IDE to unload the controls (and therefore the classes they use) from the previous build. (Static classes, Singletons, resurrecting GC'd objects, etc may also complicate this) Thinking about it a little more... Do your usercontrol nest other usercontrols from the same project? If so, that may be the problem. The designer for the "outer" usercontrol will be hosting a usercontrol from the previous build. The designer for the "outer" user control will be creating GraphConfiguration based on the current class definition and of course the "inner" user control (from the previous build) will be using the GraphConfiguration from the previous build. > > If not, start the user controls OnLoad, painting, etc > > routines with code like this: > > > > if (this.DesignMode) > > return; > > > > I'll give this a whirl as well and see what happens. Though any > further > comment on my first response above (the one I said I didn't understand) > would be great. This is the generally recommended approach. If you get into a habit of checking this.DesignMode it stops a lot of unexpected problems (and helps to stop the IDE feeling sluggish as it runs runtime code (possibly trying to access databases, etc!)) =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com