I am getting the following error whenever i tried to open forms in VS 2005 solution in design mode. I tried rebuilding the solution several times, but still the issue persists.I referred couple of messages in the forum and applied the resolution provided in those, but still the issue persists. I am stuck and not able to do any modification to the controls and their properties.
Is there is any fix available for this issue?
One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes. Clicking on each error will take you to the line of code that caused it.One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes. Clicking on each error will take you to the line of code that caused it.
| | suryavbnet2005 Monday, February 06, 2006 4:34 AM | Hi -
I've moved this question to the Window Forms Designer forum.
Thanks,
Karen | | Karen Liu MSFT Wednesday, February 08, 2006 1:17 AM | ...what were the errors? | | CommonGenius.com Wednesday, February 08, 2006 2:54 PM | I am using Infragistics controls in my application, whenever i tried to open the form in design mode, i am getting the following error.
Object of type 'Infragistics.Win.Appearance' cannot be converted to type 'Infragistics.Win.AppearanceBase'. Hide |
|
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement) | | | suryavbnet2005 Wednesday, February 08, 2006 5:43 PM | I am receiving the error below quite often.
It happens when there is a Usercontrol on the Designer that has a public property that is set to NULL by the designer.
I remove that NULL attribute from the resx file, rebuild, then I can open the designer, But save and close, try to reopen you get the same error.
Since I get it for more than one object, I removed the object name from the message.
PS:
I have the VS 2005hotfix mentioned in the KB article http://support.microsoft.com/kb/912019/en-us
Thanks
|
|
One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes. |
|
Object of type'XXXXX' cannot be converted to type 'XXXXX'. Hide
|
|
at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr) at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean doVisibilityCheck, Boolean doCheckConsistency) at System.Runtime.Serialization.FormatterServices.SerializationSetValue(MemberInfo fi, Object target, Object value) at System.Runtime.Serialization.ObjectManager.CompleteObject(ObjectHolder holder, Boolean bObjectFullyComplete) at System.Runtime.Serialization.ObjectManager.DoNewlyRegisteredObjectFixups(ObjectHolder holder) at System.Runtime.Serialization.ObjectManager.RegisterObject(Object obj, Int64 objectID, SerializationInfo info, Int64 idOfContainingObj, MemberInfo member, Int32[] arrayIndex) at System.Runtime.Serialization.Formatters.Binary.ObjectReader.RegisterObject(Object obj, ParseRecord pr, ParseRecord objectPr, Boolean bIsString) at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObjectEnd(ParseRecord pr) at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseRecord pr) at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run() at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream) at System.Resources.ResXDataNode.GenerateObjectFromDataNodeInfo(DataNodeInfo dataNodeInfo, ITypeResolutionService typeResolver) at System.Resources.ResXDataNode.GetValue(ITypeResolutionService typeResolver) at System.Resources.ResXResourceReader.ParseDataNode(XmlTextReader reader, Boolean isMetaData) at System.Resources.ResXResourceReader.ParseXml(XmlTextReader reader)
| | | durayakar Friday, March 03, 2006 10:02 PM | You don't need to rebuild, if you remove the NULL entry from the resx file (despite the scary error message "touch this and get killed" when you modify the resx file), then just go back to the designer, and it displays.
Please suggest... | | durayakar Friday, March 03, 2006 10:05 PM | Can you give more information on what this property is?
Can you post some sample code of the form and the control that it uses?
| | Benjamin Wulfe - MS Monday, March 06, 2006 3:34 AM | You can use a System.Collections.Generic.List<T> to regenerate the problem
- Create a user Control
- Add a private field like:
private List<SortedList> myProblemList = new List<SortedList>();
- Add a public property like :
public List<SortedList> ProblemList { get{ return myProblemList ;} set{ myProblemList = value;} }
- Add this usercontrol to a form
- Add some more code to the form
- close the form desogner
- Try to open it again
I have found a workaround though :
There is an attribute for the properties, if I add this to my UserControl seems to be working fine... But I don't think it is the best way to do it ...
[ DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public List<SortedList> ProblemList { get{ return myProblemList ;} set{ myProblemList = value;} } | | durayakar Monday, March 06, 2006 2:08 PM | This is close. To get it working, it should be something like this:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public List<SortedList> ProblemList { get{ return myProblemList ;}
//set{ myProblemList = value;} and remove this
}
By making the propert DesignerSerializationVisibility.Hidden, you are not generating code for the property at all. This will "fix" your problem, but may not be exactly what you wanted.
Changing it to "Content" and removing the set will tell the designer to serialize each of its items and add calls to "Add" to add each item. The only problem you will have is if SortedList is complex and the designer doesn't know how to generate code for it.
To solve this problem, create a derived TypeConverter class and implement ConvertTo for the Type "InstanceDescriptor". You will have to choose a constructor and send in any parameters to the constructor (for example, if you have a constructor that takes an object[], then pass that as one parameter).
| | Benjamin Wulfe - MS Monday, March 06, 2006 4:55 PM | Thank you very much for your prompt reply.
Making it hidden worked fine for me, because I was setting it in runtime anyway, and I need to set it, so cannot remove set...
My actual class that I use for the list is like :
public class Bag:SortedList { private GetString(string val) { if(this[val]==null) { this[val] = ""; } return this[val]; }
public string Title { get{ return this.GetString("Title");} set{ this["Title"] = value;} } }
and has string , int , decimal, byte and short strongly named properties such as above.
I was thinking to refrain from custom serialization and type conversion by doing that :)
Is that considered a complex sorted list?
Thank you again. | | durayakar Monday, March 06, 2006 5:04 PM | PS:
If I use public "Typed Dataset"s I run into the same issue....
Also, In the typed dataset scenario, if I create my form, add the user control, and then modify my dataset (or just recompile the project that contains theDataset for that matter) that is exposed as public in my user control, I get another error telling me that thetpye does not match (or something like that).
I used the same approach, because I need to set time at runtime.
I will post a new thread for Visual Inheritance in general.
Duray AKAR | | durayakar Monday, March 06, 2006 5:24 PM | I'm getting this same ridiculous error. However, the fix posted here has no effect on my code. I have a user control on a form. The user control has a "Collection(Of DesignObject)" property.
Here is the code:
Private _designObjects As New Collections.ObjectModel.Collection(Of DesignObject)
<DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _ Public ReadOnly Property DesignObjects() As Collections.ObjectModel.Collection(Of DesignObject) Get Return _designObjects End Get 'Set(ByVal value As Collections.ObjectModel.Collection(Of DesignObject)) ' _designObjects = value 'End Set End Property
The problem is inconsitent. I cannot reproduce it at will. When it does happen, it is either when the form is visible and I do F5 to compile & run, or when the form is not visible and I load it in the designer again.
The Error is: (I have replaced my app's name with XXXXX) Object of type 'XXXXX.DesignObject[]' cannot be converted to
type 'XXXXX.DesignObject[]'.
| | gcox18 Monday, March 06, 2006 10:48 PM | Take a look at the tread
"Unable to cast object of type 'X' to type 'X' "
Juan Ignacio GelosStarted: 13 Dec 2005 12:42 PM
Maybe you have the same effect? I mean, assembly version conflict.
This (assembly version conflict) would explain why the hotfix doesn't help and the general instability / "in-reproduceability" of the problem.
HTH,
Draiko | | DRaiko Tuesday, March 07, 2006 9:26 AM | suryavbnet2005,
I was running into the exact same issue using Infragistics controls and the 'Infragistics.Win.Appearance' cannot be converted to type 'Infragistics.Win.AppearanceBase' messagetoday.
DRaiko's suggestion was certainly on the right track for me, though it wasn't "Copy Local" being set to true -- it was "Specific Version" set to false. What I did was I went through all of my references and checked both the "Copy Local" and the "Specific Version" property. It seems all of my Infragistics assemblies have "Specific Version" set to true (however, the CLR references don't).
I removed the reference that had Specific Version to False, readded the reference to that assembly and my problem was fixed.
The Infragistics assemblies should be pointing to c:\Program Files\Infragistics\etc. instead of c:\windows\assemblies\gac_msil\Infragistics.*.
I'm still not sure how that property got changed in this project. | | David Mohundro Tuesday, April 04, 2006 4:19 PM | I was having the exact same error as originally described (winappearance cannot be converted to winappearancebase...).
After cursing this VS2005 win forms designer (which I've still got issues with!) and Infragistics, I discovered that the problem was of my own doing ( - man I hate that!!).
I have both Infragistics v6.1 for CLR 2.0 loaded, and my old Infragistics v5.3 for CLR 1.1 available in my toolbox. I had accidently grabbed a v5.3 UltraCombo control when adding a new combo to my form. Of course, as soon as I dropped it, I had realized my screw up and deleted it off of my form. After cleaning up my references, I could not get rid of the designer throwing up the WinAppearance exception.
Finally, I opened the Licenses.licx file and found that last freakin' reference to the Infragistics v5.3 control. I deleted that line out and was able to open the form designer again.
Needless to say, those v5.3 controls are no longer in my toolbox.
(I was just about ready to turn my notebook into a frisbee and see if I could fly it to the building across the street. Hopefully, this little admission will keep someone else from making it that far - although those new dual cores sound pretty cool !-)
| | SValentine Thursday, May 04, 2006 8:13 PM | You shouldn't see this as entirely your fault either. We have gotten quite a bit of feedback from customers that the error messages shown in the designer don't help. Its very easy to get blocked when this WSOD (white screen of darn) is displayed.
We are looking at (possibly) improving this screen to give better suggestions on how to fixthese errors. We do need as much data as possible about the types of errors encountered and any fixes found.
If you could enter a suggestion in the product feedback site:
http://lab.msdn.microsoft.com/productfeedback/
it would help tremendously. This site allows you to track progress and developer feedback on issues you find. The more data we can collect, the better feedback this screen can give on how to fix errors.
And thanks for your patience in investigating this problem. I don't claim that all errors are user errors and we are working hard to improve this area of the designer.
| | Benjamin Wulfe - MS Thursday, May 04, 2006 8:33 PM | I made the same mistake and mixed different versions.
I deleted all entry in the licenses.licx file and also all entry from infragistics in the toolbox.
Then I stored and closed all damaged form and closed also the licenses.licx. After a new start, the entry for the old v5.1 control was not in the licx file. When i tried to open the form in the designer, the error msg comes again, -- and in the .licx was again the license entry for the old version?
How can I delete the reference to the old version? Where is this information stored?
Thanks for help and every suggestion.

| | ewgewg Tuesday, May 23, 2006 5:11 PM | did you remove all the references from you project ? entirely...
What I do is,
remove the old version of infragistics add the new infragistics toolbar remove all the references from my project clean up the licensex.licx file open a blank form, Drag drop the infragistics components that I use
then compile
worked for me on 3 different computers, and on different version changes for different 3rd party tools as well...
Hope it helps
| | durayakar Tuesday, May 23, 2006 5:17 PM |
En mi caso el problema era el siguiente:
Yo tenia un proyecto antiguo con la versión 5.3, al pasarlo a vb 2005 cambie las referencias a las librerias de la versión 6.1.
El problema era que mi programa usa una libreria hecha por mi mismo que en su interior hacía referencia a la versión 5.3, es decir, el proyecto principal apuntaba a la 6.1 y la libreria a la 5.3.
He cambiado las referencias de la libreria a la versión 6.1, he compilado y todo funciona perfectamente.
Mirad si tenéis alguna libreria o similiar que internamente haga referencia a una versión distinta del proyecto principal.
Un saludo. | | Fenixx Thursday, June 08, 2006 8:24 AM | I was getting this one too:
Object of type'XXXXX' cannot be converted to type 'XXXXX'.
I'm new to C# and I couldn't figure out how to get figure out the workarounds suggested.
For other C# noobs like me, I thought I would post what I did to get rid of the WSOD (white screen of darn).
On my custom control, I had some custom properties that returned List<>. I just converted my properties into functions. Then I restarted visual studio, rebuilt the project, removed some out-of-date initialization code that the designer created, and then everything was cool.
| | Mark Currie Tuesday, August 08, 2006 11:28 AM | Unable to cast object of type 'X' to type 'X'
You must create your TypeConverter and override CanConvertTo and ConvertTo
There you need to convert your class to InstanceDescriptor.
This could be done in following way:
if (destinationType == typeof(InstanceDescriptor))
return new InstanceDescriptor(typeof(GraphState).GetConstructor(
new Type[]{typeof(Point),typeof(Image)}),
new object[]{((GraphState)value).Origin, ((GraphState)value).Image}); | | OZone_2 Tuesday, October 24, 2006 10:46 AM | I am just wondering. I have the same problem. But it doesn't occurs with all my controls.
Any clues to the conditions that create this bug ?
Maybe I don't get this error on my other form because they are ported from visual studio 2003.
Thanks. | | MGVG345 Wednesday, April 11, 2007 6:39 PM | Thanks David Mohundro, that solved my problem.
| | Joe Pepper Thursday, July 03, 2008 12:08 PM | I got the same error repeatedly ... nonstop ... 24 hours ... very frustrating.
I also observed that the RESX file was getting corrupted, which meant that I had torestore it from a previous session. I tried the trick with indexing, and then it occurred to me that AutoSave or Build-PreSave was corrupting the RESX, which was the case. I disabled all auto saving and now the RESX does not get corrupted. Yipee. I still have to occassionaly Clean and Rebuild, but at least I no longer have to restore the RESX.. 
Dave
| | TaraBird Wednesday, July 16, 2008 10:21 PM |
|