/Software Development

IO Permissions Exception during XML Serialization

Today I fired up an application that I hadn’t touched in quite some time—I ran it, and got a very unusual exception error message while attempting to serialize an object from some XML:

Unable to generate a temporary class (result=1).

At first I suspected it was some silly Windows 7 user permissions problem, but I was running everything as Administrator! What could it be?

I added some breakpoints in my code, and figured out the line which caused the exception:

System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer( typeof(System.Security.Cryptography.RSAParameters));

In this line a temporary DLL was being generated into my local Temp folder, but could not be written there for some reason. I searched the Internet for why this could be the case and found a lot of “solutions” which were not applicable to me—everything form not enough disk space, to IIS needing hotpatches!

Eventually I was able to find a suggestion someone had made about antivirus blocking the creation of files.

As this was the only suggestion even remotely close to my environment, I decided to set my “Defense+ Security Level” to “Disabled” in COMODO and restarted the app.

SUCCESS!

Pretty unusual since COMODO usually asks me before blocking applications…but there you have it.

Bogdan Varlamov

Bogdan Varlamov

I believe technology makes life more worthwhile :)

Read More