在加载设计器错误之前防止可能的数据丢失 [英] To prevent possible data loss before loading the designer errors

查看:60
本文介绍了在加载设计器错误之前防止可能的数据丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用vb.net 2010我使用自定义库进行按钮形状。所有事情都很顺利,直到我决定将我的应用框架网络从3.5更改为4.然后我创建的按钮不再显示表格设计,我得到这些错误,当我将框架网络改回3.5时,它甚至无法修复



类型为'System.Int32的对象'无法转换为'System.Int16'类型。

变量'Recording'要么未声明,要么从未被分配。 [code] Me.TabPage6.Controls.Add(Me.Recording)[/ code]




这是调用栈
$ b System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager,String exceptionText,String helpLink)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager)$ b

i'm using vb.net 2010 i use custom lib for button shape..every thing was going fine till i decided to change my app framenetwork from 3.5 to 4. then buttons that i have created are not showing any more in the form desgin and i get these errors and it dosn't even get fix when i change the framenetwork back to 3.5

Object of type 'System.Int32' cannot be converted to type 'System.Int16'.
The variable 'Recording' is either undeclared or was never assigned. [code]Me.TabPage6.Controls.Add(Me.Recording)[/code]


this is the call stack

at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement) 





i也会收到此错误

重复成员声明'录制'

这是调用堆栈



i also get this error
Duplicate declaration of member 'Recording'
and this is the call stack

at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.ComponentCodeDomSerializer.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatementToInstance(IDesignerSerializationManager manager, CodeStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.Windows.Forms.Design.ControlCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.DeserializeName(IDesignerSerializationManager manager, String name, CodeStatementCollection statements) 



现在我有该按钮的代码,我也可以在项目属性中看到它,但我看不到它在表格设计上。我也包括截图。如何解决这个问题?



http://s9.postimage .org / lxj5kc8en / image.jpg [ ^ ]

http://s11.postimage.org/ijj47k6lv/image.jpg [ ^ ]

< a href =http://s9.postimage.org/ryq18w9sf/image.jpg> http://s9.postimage.org/ryq18w9sf/image.jpg [ ^ ]

http://s17.postimage.org/4k9s87vlr/image.jpg [ ^ ]


now i have the code for that button and i also can see it in project properties but i can't see it on the form desgin. i include screenshot as well. how to fix this?

http://s9.postimage.org/lxj5kc8en/image.jpg[^]
http://s11.postimage.org/ijj47k6lv/image.jpg[^]
http://s9.postimage.org/ryq18w9sf/image.jpg[^]
http://s17.postimage.org/4k9s87vlr/image.jpg[^]

推荐答案

我在改变.Net框架后遇到了与C#相同的问题从3.5到4.0并将第三方组件(VistaDB)从.Net 2.0升级到.Net 4.0我无法在Designer中查看其中一个表单(LaunchFindAlike)并收到警告消息,其中包含以下详细信息:



I had the same problem with C# - after changing the .Net framework from 3.5 to 4.0 and upgrading a 3rd party component (VistaDB) from .Net 2.0 to .Net 4.0 I could not view one of the forms (LaunchFindAlike) in the Designer and received the warning message with the following details:

Could not find type 'LaunchFindAlikeNS.MultiColumnComboBox'
Variable mcboErrorText either undeclared or never assigned
Could not load file or assembly VistaDB.5.NET20 …. The system cannot find the file specified
Variable KeywordListTableAdapter either undeclared or never assigned
Variable SourceIndexesTableAdapter either undeclared or never assigned
Duplicate declaration of member KeywordListTableAdapter
Duplicate declaration of member SourceIndexesTableAdapter





消息非常令人困惑,Goto Code或Show Call Stack显示无效。



我尝试将文件LaunchFindAlike.csproj(使用Notepad ++)与.Net 3.5版本的新版本进行比较,发现了许多不同之处。 (LaunchFindAlike.Designer.csproj文件完全相同)。一些差异是







The messages were very perplexing and the 'Goto Code' or Show Call Stack displays were not helpful.

I tried comparing files LaunchFindAlike.csproj (using Notepad++) for the new version with the .Net 3.5 version and found a number of differences. (The LaunchFindAlike.Designer.csproj files were identical). Some of the differences were


<reference include="VistaDB.5.NET40, Version=5.1.0.0, Culture=neutral, PublicKeyToken=dfc935afe2125461, processorArchitecture=MSIL">
      <specificversion>False</specificversion></reference>





而不是





instead of

<reference include="VistaDB.5.NET20"></reference>

< br $> b $ b








and

<none include="Settings.settings"></none>





而不是





instead of

<compile include="Properties\Settings.Designer.cs"></compile>

< br $> b $ b







and

<compile include="Settings.Designer.cs"></compile>





而不是





instead of

<compile include="Properties\Settings.Designer.cs"></compile>





我更改了LaunchFindAlike.csproj(.Net 4.0)以删除.NET40之后的所有内容,如下所示





I changed LaunchFindAlike.csproj (.Net 4.0) to remove everything after .NET40 as shown below

<reference include="VistaDB.5.NET40"></reference>





我删除了< compile include =... =>中的其他差异语句然后发现我可以查看表单但由于文件没有构建项目

Project \ ... \ LaaunchFindAlike \Properties \ Setting.Designer.cs不存在。我从Project \ ... \ LaunchFindAlike复制了这个文件,然后项目构建好了。



修复的细节可能对其他用户有所不同,但是手动编辑.csproj文件以查找违规表格以使其类似于早期版本似乎是一个useul路径。确保在更改.Net框架之前保留备份。



I removed other differences in the <compile include="" ...=""> statements and then found that I could view the form but not build the project due to the file
Project\...\LaunchFindAlike\Properties\Settings.Designer.cs not being present. I copied this file from Project\...\LaunchFindAlike and the project then built OK.

The details of the fix may be different for other users but manually editing the .csproj file for the offending form to make it resemble the earlier version seems to be a useul path. Make sure you keep a backup before changing .Net frameworks.


这篇关于在加载设计器错误之前防止可能的数据丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆