I've been having some problem serializing my objects and have narrowed the problem down to a specific case (see code below). I was getting the following error:
Error 1 Invalid Resx file. Could not load type Serialisation.Harness.Blob, Serialisation, 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. ...
Now the really strange thing is that restarting Visual Studio causes the error to go away and the code to work but then after a seemingly random number of builds (during which the said code is not changed) it will break again.
Can you see what I'm doing wrong/missing out?
Many thanks in advance,
Meto
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows.Forms;
using System.Windows.Forms.Design; using System.ComponentModel.Design;
namespace Serialisation.Harness
{
[Serializable]
public class Blob
{
public Blob()
{
}
}
[Serializable]
public class Basic
{
private List<Blob> blobs;
public List<Blob> Blobs
{
get { return blobs; }
set { this.blobs= value; }
}
public Basic()
{
basics = new List<Blob>();
}
}
public class BasicComponent : Component
{
private Basic basic = new Basic();
private IContainer components = new Container();
public List<Blob> Blobs
{
get { return basic.Blobs; }
set { basic.Blobs= value; }
}
public BasicComponent(IContainer container)
{
container.Add(this);
}
}
}