Having problems with the Designer? Try this!

Docking/MDI for Windows Forms Forum

Posted 18 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
I was recently plagued by some odd behavior in the designer for some UIStudio controls as well as controls from other vendors. Designed controls would disappear from my forms or configurations were not being restored from the previous design session. The issue was hard to track down, but, with the excellent help of Actipro Support, came across the solution.

The problem was that I was setting CopyLocal to True for the DLL references to 3rd-party controls used in my application. Normally this is okay, but these 3rd-party control DLL's were also installed in the Global Assembly Cache. This resulted in two copies of the same DLL being used by the designer for loading/saving data, and that prevents data from being properly converted between classes.

The solution... set CopyLocal to False for any assemblies used in the designer that are also installed in the GAC. Alternatively, you could remove the assmeblies from the GAC if it is not necessary for them to be there.

This is just an issue with Visual Studio's designer, and is not an issue with the excellent controls provided by Actipro Software. I wanted to share this experience with others to hopefully prevent the loss of data and time from designer issues in Visual Studio.

Comments (1)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Excellent information Boyd... thanks for the post! We plan on including this information in the documentation for UIStudio since it is important to note.

To add to this, basically there is a Visual Studio bug where both the GAC and local copies of third-party control assemblies can be loaded at the same time and therefore cause exceptions when just casting an object to its real Type. For example, in a TypeConverter, you are passed an "object" and you know what type that object is since you only set the TypeConverter on the appropriate Type. However when you do a cast to that Type in the TypeConverter, Visual Studio blows up since the Type it passes is from the local copy of the assembly and the Type you cast to is from the GAC copy of the assembly. This is ridiculous since the assemblies have the same bits, but it does blow up and is a nasty bug in Visual Studio.

To work around this, as Boyd said just keey CopyLocal = false and that prevents it from happening.

Actipro Software Support

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.