1

Closed

There was an unexpected error creating the calculation

description

There was a problem saving this calculation to the library at c:\users\username\appdata\roaming\olappivottableextensions\calculationslibrary.xml. configuration system failed to initialize. This error happens only when logged in a user(when logging in as a administrator it works)

Can someone please give a solution for this error
Closed Jul 26, 2013 at 9:55 PM by furmangg
I'm closing this assuming it is something wrong on this specific computer an not with my code. I can't reproduce. If other computers or users experience this please post a comment.

comments

furmangg wrote May 31, 2013 at 5:51 PM

Does the user logged in have full control over the c:\users\username\appdata\roaming folder? It's just creating that folder (if it doesn't exist) and writing to that XML file. So I imagine it's just a file system permission issue. Please confirm that's the problem.

lakhow wrote May 31, 2013 at 6:02 PM

Thanks for your response. Yes the user has access to that folder(also tried to create folder manually in roaming folder)

furmangg wrote Jun 1, 2013 at 9:38 PM

Reading about this error message "configuration system failed to initialize" leads me to believe there's something wrong with one of the .NET .config files:
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/41cfc8e2-c7f4-462d-9a43-e751500deb0a/

Maybe the machine.config is corrupt and needs to be restored?
http://weblogs.asp.net/hosamkamel/archive/2008/01/30/restore-machine-config-file.aspx

I don't believe my add-in creates or uses any sort of config file of its own. It uses the registry for some other settings, but that has nothing to do with the calculation library.

Any thoughts?

The code that's blowing up is pretty simple. I'm not sure which line.
    public void Save()
    {
        if (!System.IO.Directory.Exists(LibraryDirectory))
        {
            System.IO.Directory.CreateDirectory(LibraryDirectory);
        }
        XmlSerializer serializer = new XmlSerializer(typeof(CalculationsLibrary), null, new Type[] { typeof(Calculation) }, null, null);
        XmlTextWriter writer = new XmlTextWriter(LibraryPath, Encoding.UTF8);
        writer.Formatting = Formatting.Indented;
        serializer.Serialize(writer, this);
        writer.Close();
    }