Default XmlSerializer uses %TMP% folder to generate an assembly dynamically.

I got such a stack trace today:

System.InvalidOperationException: Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\Windows\TEMP\elfzvfzu.0.cs' could not be found
error CS2008: No inputs specified

at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)

And it was a surprise for me that System.Xml.Serialization.XmlSerializer creates an assembly dynamically under the covers and it uses %TMP% folder for this purposes.  Be aware of that because you may not have access to the folder within some environments and identities.

Advertisements
This entry was posted in .NET. Bookmark the permalink.

One Response to Default XmlSerializer uses %TMP% folder to generate an assembly dynamically.

  1. chart silver says:

    This is my first time go to see at here and i am genuinely happy to read everthing at single place.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s