views:

22

answers:

1

I have a win forms Usercontrol that is suddenly unable to build, with this error:

Edit- forgot to mention, The name of the project is Datatesting, it is not an external reference!

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

Navigating to the error opens to this section of 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>

Finally, when I try to open the designer for the control, I get this error:

    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   

This form has been working fine for quite awhile, and I have no idea why it's suddenly broken, or how to correct this problem.

Has anyone else seen this before and maybe knows how to resolve this?

+1  A: 

You managed to create a circular project reference somehow. The resource value looks roughly like this, when converted from base64 to bytes:

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   

This is data generated by BinaryFormatter, note that it is referencing the DataTesting assembly, the assembly that you are trying to compile. This indeed can go undetected for a while since DataTesting.dll will exist as you are editing your project. Until you do a clean build and the DLL is no longer available. Kaboom.

No idea what the resource actually means or how you got it into the resource in the first place. But you'll need to spin whatever type is stored here into another assembly so that it can be built separately. Recovering from this error, short from restoring an earlier version from SCCS, might be possible by editing the .resx file by hand and deleting the resource.

Hans Passant
While I'd love to know what I did wrong to get to this point, moving the referenced type to a seperate library project and including a reference to it cleared this up immedidiatly. Thank you.
asawyer