I have created a relatively simple repro of the issue. It is a solution with 3 projects with the same structure as my failing
project.
In the sample as in the original problem TicketConfiguration is a property that accesses a simple class that is defined in another
project within the solution.
In this case, I completely built both the UserControls before I tried to place the on the form. When I placed the UserControl on
the form I received the CAST error as shown in the attached screen capture. The message indicates the same problem that I am
having when design mode does not display.
Here is the breakdown of the solution
Project - Data - Contains 2 classes that are serialized.
Project - UI - Contains 2 user controls.
1) - TicketUI - the 'base' UserControl. It has a public property called TicketConfiguration that is used to access the 'data'
class called Ticket that is in the Data project.
2) - TicketContainerUI - the UserControl that has TicketUI placed on its design surface. That is all it has.
Project - Driver - Has a windows forms application. I tried to drag TicketContainerUI to its design surface and received the cast
error that says "...cannot cast object of type 'KMS.MSTest.Data.Ticket' to type ' KMS.MSTest.Data.Ticket'..." This stack walk
back shows a line of code similar to my original post.
The email containing the solution and screen capture is on its way to you.
[quoted text, click to view] On Fri, 31 Aug 2007 03:42:53 GMT, v-lliu@online.microsoft.com (Linda Liu [MSFT]) wrote:
>Hi Roy,
>
>Based on my understanding, you have a WinForm application project developed
>with VS2005. The project has UserControlA, UserControlB and UserControlC
>and a Form in it. You add an instance of UserControlA on UserControlB, and
>the line of code 'this.A1.TicketConfiguration =
>((KMS.Protocol.UTS.A)(resources.GetObject("A1.TicketConfiguration")));' is
>generated in the designer.cs file. At this time, the UserControlB couldn't
>be opened in the designer properly. If I'm off base, please feel free to
>let me know.
>
>It seems that the problem is caused by the TicketConfiguration property of
>UserControlA. What's the type of this property?
>
>Since there're some custom types in your project that may cause the
>problem, could you please create a simple project that could just reproduce
>the problem and send it to me? To get my actual email address, remove
>'online' from my displayed email address.
>
>Thank you for your understanding and cooperation! I look forward to your
>reply.
>
>Sincerely,
>Linda Liu
>Microsoft Online Community Support
>
>==================================================
>Get notification to my posts through email? Please refer to
>
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif >ications.
>
>Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
>where an initial response from the community or a Microsoft Support
>Engineer within 1 business day is acceptable. Please note that each follow
>up response may take approximately 2 business days as the support
>professional working with you may need further investigation to reach the
>most efficient resolution. The offering is not appropriate for situations
>that require urgent, real-time or phone-based interactions or complex
>project analysis and dump analysis issues. Issues of this nature are best
>handled working with a dedicated Microsoft Support Engineer by contacting
>Microsoft Customer Support Services (CSS) at
>
http://msdn.microsoft.com/subscriptions/support/default.aspx. >==================================================
>
>This posting is provided "AS IS" with no warranties, and confers no rights.
-------------------------------------------
Roy Chastain
KMSYS Worldwide, Inc.