Posts Tagged ‘ UAC ’

Error report after user closes Revit

I got  bug report, where the customer was saying, that Revit is crashing when our addin is installed. After discussion, I got some more information, but still not enough to solve it. It was indeed problem with our addin – Revit didn’t crash, but the user got an error report, when Revit was closing.

After some more investigation, I found out, that this wasn’t happening on development machines, since we got UAC turned off. Once I got UAC to “Always notify”, I got the same problem.

The reason behind this was, that we are creating log file in SpecialFolder.CommonApplicationData directory (C:\ProgramData\ on on Windows 7 ) , which is where Windows does not allow us to write anything. Problem was solved once I moved log file to current user’s application data (SpecialFolder.ApplicationData). I might add, that I am on Windows 7 64bit.

Below are the directories, which are affected by UAC setting (Windows Vista & Windows 7):

SpecialFolder.CommonApplicationData: C:\ProgramData
SpecialFolder.ProgramFiles: C:\Program Files

This one is safe:

SpecialFolder.ApplicationData:        C:\Documents and Settings\myusername\Application Data

If for some reason you wan to keep your file in these directories, you can try with UAC elevation.
And those folders on Windows XP:

SpecialFolder.CommonApplicationData:  C:\Documents and Settings\All Users\Application Data
SpecialFolder.ProgramFiles:           C:\Program Files
SpecialFolder.ApplicationData:        C:\Documents and Settings\myusername\Application Data

Another interesting thing is, that any Revit shared parameter definition file stored in CommonApplicationData isn’t affected by this setting.

Enhanced by Zemanta