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.

Advertisements

About Bogdan Varlamov

A .NET Software Engineer that strongly believes technology should simplify and improve the quality of our lives instead of making them more complicated. View all posts by Bogdan Varlamov

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

%d bloggers like this: