Question

I have an application that I am attempting to profile with CLRProfiler, written in .NET 4.0 and WPF running on the .NET Framework 4 Client Profile. The application loads a data file shortly after startup, the location to which is in app.config (so it is not selected interactively when the program is running). When the application is launched from Visual Studio or Windows Explorer, everything works fine.

When launching the application from CLRProfiler, however, the application crashes with an UnauthorizedAccessException attempting to load the file.

Attempting to fix the issue, I gave Full Control permissions to said file to myself, Domain Users, and Everyone yet the issue continues. When monitoring Task Manager, the short-lived process shows up has having been launched under my user ID.

Does anyone know how to resolve this issue with CLRProfiler?

Was it helpful?

Solution

Ultimately, this turned out to be a combination of two problems:

  1. Not running as administrator.

  2. The data file referenced above had a path specified in a configuration file, but the path was relative. When CLRProfiler launched the application, the working directory remained that of the profiler instead of being switched to the application under analysis. Since I was running unprivileged, the failure to open the data file was actually manifested as an UnauthorizedException because the application did not have permissions to root around in the folder where the profiler was installed.

After correcting both of these (the first by running as administrator the second by changing the config file to use an absolute path), the issues disappeared.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top