1

我有一个突然无法构建的 win 表单 Usercontrol,出现以下错误:

编辑-忘了提,项目名称是Datatesting,它不是外部参考!

Error   1   Invalid Resx file. Could not load type DataTesting.TableColumn, DataTesting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null which is used in the .RESX file.  Ensure that the necessary references have been added to your project. Line 129, position 5.    C:\Team Explorer\DataTesting\TableColumnListEditor.resx 129 5   DataTesting

导航到错误会打开 TableColumnListEditor.resx 的这一部分:

  <data name="tableColumnEditor1.EditingTableColumn" mimetype="application/x-microsoft.net.object.binary.base64">
    <value>
      AAEAAAD/////AQAAAAAAAAAMAgAAAEJEYXRhVGVzdGluZywgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJl
      PW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwFAQAAABdEYXRhVGVzdGluZy5UYWJsZUNvbHVtbgYA
      AAAVPE5hbWU+a19fQmFja2luZ0ZpZWxkGDxTcWxUeXBlPmtfX0JhY2tpbmdGaWVsZBs8RmlsbE1ldGhv
      ZD5rX19CYWNraW5nRmllbGQaPFByZWNpc2lvbj5rX19CYWNraW5nRmllbGQbPElzSWRlbnRpdHk+a19f
      QmFja2luZ0ZpZWxkGzxJc051bGxhYmxlPmtfX0JhY2tpbmdGaWVsZAEBAQAAAAUBAQIAAAAGAwAAAAAG
      BAAAAAAGBQAAAAABMAAACw==
    </value>
  </data>

最后,当我尝试打开控件的设计器时,出现此错误:

    To prevent possible data loss before loading the designer, the following errors must be resolved:   



    1 Error   

  Ignore and Continue   
    Why am I seeing this page?   

   Unable to find assembly 'DataTesting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.       

Instances of this error (1)  

1.   Show Call Stack  

at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.ObjectMap.Create(String name, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
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)  

Help with this error  

MSDN Help   


Forum posts about this error  

Search the MSDN Forums for posts related to this error   

这个表格已经运行了很长一段时间,我不知道为什么它突然坏了,或者如何纠正这个问题。

有没有其他人以前见过这个,也许知道如何解决这个问题?

4

1 回答 1

3

您设法以某种方式创建了一个循环项目引用。当从 base64 转换为字节时,资源值大致如下:

00000000:  00 01 00 00 00 FF FF FF │ FF 01 00 00 00 00 00 00           
00000010:  00 0C 02 00 00 00 42 44 │ 61 74 61 54 65 73 74 69       BDataTesti
00000020:  6E 67 2C 20 56 65 72 73 │ 69 6F 6E 3D 31 2E 30 2E   ng, Version=1.0.
00000030:  30 2E 30 2C 20 43 75 6C │ 74 75 72 65 3D 6E 65 75   0.0, Culture=neu
00000040:  74 72 61 6C 2C 20 50 75 │ 62 6C 69 63 4B 65 79 54   tral, PublicKeyT
00000050:  6F 6B 65 6E 3D 6E 75 6C │ 6C 05 01 00 00 00 17 44   oken=null   D
00000060:  61 74 61 54 65 73 74 69 │ 6E 67 2E 54 61 62 6C 65   ataTesting.Table
00000070:  43 6F 6C 75 6D 6E 06 00 │ 00 00 15 3C 4E 61 6D 65   Column   <Name
00000080:  3E 6B 5F 5F 42 61 63 6B │ 69 6E 67 46 69 65 6C 64   >k__BackingField
00000090:  18 3C 53 71 6C 54 79 70 │ 65 3E 6B 5F 5F 42 61 63   <SqlType>k__Bac
000000A0:  6B 69 6E 67 46 69 65 6C │ 64 1B 3C 46 69 6C 6C 4D   kingField<FillM
000000B0:  65 74 68 6F 64 3E 6B 5F │ 5F 42 61 63 6B 69 6E 67   ethod>k__Backing
000000C0:  46 69 65 6C 64 1A 3C 50 │ 72 65 63 69 73 69 6F 6E   Field<Precision
000000D0:  3E 6B 5F 5F 42 61 63 6B │ 69 6E 67 46 69 65 6C 64   >k__BackingField
000000E0:  1B 3C 49 73 49 64 65 6E │ 74 69 74 79 3E 6B 5F 5F   <IsIdentity>k__
000000F0:  42 61 63 6B 69 6E 67 46 │ 69 65 6C 64 1B 3C 49 73   BackingField<Is
00000100:  4E 75 6C 6C 61 62 6C 65 │ 3E 6B 5F 5F 42 61 63 6B   Nullable>k__Back
00000110:  69 6E 67 46 69 65 6C 64 │ 01 01 01 00 00 00 05 01   ingField   
00000120:  01 02 00 00 00 06 03 00 │ 00 00 00 06 04 00 00 00          
00000130:  00 06 05 00 00 00 00 01 │ 30 00 00 0B                    0   

这是由 BinaryFormatter 生成的数据,请注意它引用了 DataTesting 程序集,即您尝试编译的程序集。这确实可以在一段时间内未被检测到,因为 DataTesting.dll 在您编辑项目时将存在。直到您进行干净的构建并且 DLL 不再可用。卡布姆。

不知道资源的实际含义或您最初是如何将其放入资源中的。但是您需要将此处存储的任何类型旋转到另一个程序集中,以便可以单独构建它。可以通过手动编辑 .resx 文件并删除资源来从此错误中恢复,而不是从 SCCS 恢复早期版本。

于 2010-09-20T14:32:20.887 回答