Sunday, March 16, 2008

Deserialization failed: The type initializer for "Microsoft.ReportDesigner.Drawing.Language" threw an exception.

I had this error because I registered custom CultureInfo with same name that already exists in collection.

Above is peace of code that you can use to check if you have the same problem. If this code don't throw an exception, than you have some other problem.

private void test()
CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
Hashtable hashtable = new Hashtable();
ArrayList m_languages = new ArrayList();
hashtable.Add("", "Default");
for (int i = 0; i < cultures.Length; i++)
CultureInfo info = cultures[i];
if (info.Name != "")
hashtable.Add(info.Name, info.DisplayName);

No comments: