Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Good morning all,
I am facing a problem in my VS 2010 Designer.
I was just checking something and tried to open the Designer-View which normally shows me the form, but now it comes up with an error:
can not convert type xxx.yyy.zzz[] to type xxx.yyy.zzz[]

I triple checked and it is indeed the same type.

I know about errors in designer but this one I can not track down (the complete errormessage is at the end of this post)

Any ideas where to check and what to check... no line-numbers with the error... unfortunately ;)

thanks in advance and have a nice day
Andy

Error-Message:
bei System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
bei System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
bei System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean doVisibilityCheck, Boolean doCheckConsistency)
bei System.Runtime.Serialization.FormatterServices.SerializationSetValue(MemberInfo fi, Object target, Object value)
bei System.Runtime.Serialization.ObjectManager.CompleteObject(ObjectHolder holder, Boolean bObjectFullyComplete)
bei System.Runtime.Serialization.ObjectManager.DoNewlyRegisteredObjectFixups(ObjectHolder holder)
bei System.Runtime.Serialization.ObjectManager.RegisterObject(Object obj, Int64 objectID, SerializationInfo info, Int64 idOfContainingObj, MemberInfo member, Int32[] arrayIndex)
bei System.Runtime.Serialization.Formatters.Binary.ObjectReader.RegisterObject(Object obj, ParseRecord pr, ParseRecord objectPr, Boolean bIsString)
bei System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObjectEnd(ParseRecord pr)
bei System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseRecord pr)
bei System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
bei System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
bei System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
bei System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
bei System.Resources.ResXDataNode.GenerateObjectFromDataNodeInfo(DataNodeInfo dataNodeInfo, ITypeResolutionService typeResolver)
bei System.Resources.ResXDataNode.GetValue(ITypeResolutionService typeResolver)
bei System.Resources.ResXResourceReader.ParseDataNode(XmlTextReader reader, Boolean isMetaData)
bei System.Resources.ResXResourceReader.ParseXml(XmlTextReader reader)
Posted
Updated 28-Feb-11 22:46pm
v2

The designer "magically" serializes custom objects into resource files. I would guess that your custom class has changed and thus the old version cannot be deserialized.
You should also check if you have two different versions of one assembly flying around.
 
Share this answer
 
Comments
hoernchenmeister 1-Mar-11 5:54am    
Thanks Robert for this information. Sounds good to me...
Do you have any idea where to check in order to remove the previously serialized CustomObject?
Or where to suppress this?
I made sure this is the only copy of the assembly flying around.
hoernchenmeister 1-Mar-11 10:40am    
Douh, the problem went away after rebooting...
Anyway, thank you Robert for explainig the cause for the problem.
I didn't knew this ;)
best regards
Andy
fjdiewornncalwe 1-Mar-11 14:16pm    
That would indicate that Studio was having caching issues of some sort.
This is yet another case which shows that you always should work under Revision Control system!
This is easy and effective.

Please see this discussion: Revision control systems, which to choose from?[^].

—SA
P.S.: Please forgive me for off-topic. I still think this is the most useful advice, in practice.
 
Share this answer
 
Comments
hoernchenmeister 2-Mar-11 2:30am    
I totally agree with your opinion on this topic. I used to work a lot with svn (Tortoise) in the past, even SourceSafe (but luckily that's quite a while ago).
So your advice on using such systems is a really good one!!!

I just cant span the bridge between your advice and my designer crashing (and working again after restarting VS).
Would you mind and explain the difference that using a revision control system would make according to the designer-problem? It seeme that I don't know too much about the "magic" happening in the background of VS that causes the problem.
Thanks for your advice, I really appreciate it and I already readdressed the need for revision control to my supervisor,
best regards
Andy
Sergey Alexandrovich Kryukov 2-Mar-11 3:03am    
There is no bridge, sorry. And I'm happy you don't need my advice, because you already going to do right thing. SVN + Tortoise is my best choice so far, too. I only thought that you will recover from design-time exception problem anyway, but wanted to help you to avoid it in future, which is more important. There is a famous Spolsky's list of what should be in development (http://www.joelonsoftware.com/articles/fog0000000043.html). If just one of 12 items is missing (one-step build, version control), you team is not developing but wasting time. Show the list to you supervisor. And you don't have to wait. Installing revision control on a local computer will take half an hour maximum and will pay off on the same data. Later on, you will be able to move your data base on your server.

You have serialization error, fixing it is labor-taking. I would restore previous step from Subversion and start over, it will be much cheaper. The revision control system makes no difference to designer or not designer -- it will restore everything you use as a source code.

I use different approach which saves me a lot of time. Developing to much in designer is a waste of time, because the work is highly manual, compared to C# coding. Think logically, designer only good when you see the graphics as you work, hence, you should create only layout. To avoid the situations you're having right now, no serious code should be placed in designer. For example, I never add events. Moreover, auto-generated code is gravely obsolete, its quality is not good: not using anonymous delegates in for events is a huge waste of time and supportability sacrifice. I faced the problems of now showing designer windows due to exception long time ago and find quite a few reasons for designer instabilities (perhaps different from yours). My way is reducing designer's work. You can look at any demo codes from any of my CodeProject articles to see what I mean.

--SA
hoernchenmeister 2-Mar-11 3:39am    
You are totally right ;)

I'll accept this solution because I really think this is a very important issue for development in general. And of course it would have helped me with restoring my designer, especially regarding the time it takes when recovering from such errors without revision control.

I really appreciate your effort on this, even if some might think this is an off topic solution.
Beeing on topic sometimes means changing my point of view from fixing an error to avoiding an error, or in this case to better recover from such.

Thanks again and have a great week
Andy
Sergey Alexandrovich Kryukov 2-Mar-11 19:52pm    
Thank you.

(I must admit I rarely answer directly to the question and still think this is right thing to do. This is a self-reference problem: asking a question correctly a part of the question. A person who needs help often doesn't know exactly what to ask for, but the same reason she or he does not know the answer...)

Thank you for accepting my Answer.
Good luck, call again.
--SA

hoernchenmeister 3-Mar-11 6:44am    
There is nothing wrong with your approach ;)
Quite often it's like in real life, the way is much more intersting than the destination itself, especially if you leave the main route and check out some hidden trails ;)

Cheers
Andy

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900