The XmlSerializer constructor generates a pair of classes derived from XmlSerializationReader and XmlSerializationWriter by analysis of the classes using reflection.
Temporary C# files are created and compiled into a temporary assembly and then loaded into a process.
The XmlSerializer caches the temporary assemblies on a per-type basis as the code generated like this is expensive. This cached assembly is used after a class is created. Therefore the XmlSerialize requires full permissions on the temporary directory which is a user profile temp directory for windows applications