We are having a problem whenever our application makes use of the XML Serializer, when we are logged in as a user who has a username containing Japanese characters.
We have prepared a sample application that tests the serializer on its own:
TestClass myClass = new TestClass();
myClass.MyString = "Hello World!";
using (MemoryStream stream = new MemoryStream())
{
XmlSerializer serializer = new XmlSerializer(
typeof (TestClass));
serializer.Serialize(stream, myClass);
}
MessageBox.Show("Serialization Complete!");
Where TestClass is defined as:
[Serializable]
public class TestClass
{
public string MyString { get; set; }
}
When Serialize() is called, the following exception is reported:
System.InvalidOperationException: Unable to generate a temporary class (result=1). error CS0016: Could not write to output file 'c:\Users\??????\AppData\Local\Temp\qas_8hjs.dll' -- 'The directory name is invalid. '
Note the '?????' where the user name should be displayed.
We have tested this using a user with an English character-set based name, and it is fine.
Is there something we have neglected to set up (for example any environment or AppDomain settings?) or is this a bug in the XML serializer?
I know this is pretty specialist, but any insights whatsoever would be appreciated!