问题
I have a problem that I hope can be fixed. I have been working on a project in VS 2010 - and it seems things are falling apart faster than I can fix them. I have not changed how I am coding or using the designer from the previous months... Here are some screen shots - perhaps someone can help me figure out what's going on here? I know this is rather vague - but I'm pulling my hair out, and maybe someone else has been in this boat!
These are from the TabControl craping out on me, an things are missing off my ToolStrips too!
HELP! -- Andrew


UPDATE
The above issues are fixed, and I was able to use the designer for a limited time - however after a build I now get the errors below... I have removed bin / obj folders to no avail.
To prevent possible data loss before loading the designer, the following errors must be resolved:
Object does not match target type
at System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.SecurityUtils.MethodInfoInvoke(MethodInfo method, Object target, Object[] args)
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertyAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement, CodePropertyReferenceExpression propertyReferenceEx, Boolean reportError)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
SO NOW I'm trying to figure out this half of the problem...
回答1:
Some times below helps to catch design time errors. Reference
1) Start a second instance of visual studio
2) go the the Tools menu, "Attach to process", select the 'devenv.exe' process, and click the 'attach' button.
3) In the Debug/Exceptions menu,
Turn on exception catching when first thrown (in the Debug->Exceptions menu).
4) Open the designer with the debugger attached.
5) The second visual studion will break on your error.
回答2:
Does your TabControl have many tabs? Older versions of WinForms had some bugs when tabs could not visually fit into the TabControl width.
First save your original source somewhere safe, then try deleting tab-by-tab to see if this changes anything. If it does, then at least you have diagnosed the problem and you may have a chance to redesign your UI with fewer tabs...
回答3:
You've removed or changed the type a property from one of your derived or usercontrol classes that you dropped onto a form. When you dropped it on, it serialized all the properties into the form. Now when you are trying to open the form it's dying because the properties in the serialized version no longer matches the actual class. Unfortunately I don't know how to fix this beyond restoring the removed or changed property.
来源:https://stackoverflow.com/questions/7264598/visual-studio-is-falling-apart-on-me