lishijie211 / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

System.UnauthorizedAccessException on saving report #778

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a .gallio project under XP that creates reports
2. Transfer project to Windows 7
3. Load project and run tests

What is the expected output? What do you see instead?
Expected output is normal run of tests

System.UnauthorizedAccessException: Access to the path 'C:\Users\Documents and 
Settings\Bender\Application Data\Gallio\Icarus\Reports' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj)
   at System.IO.Directory.CreateDirectory(String path)
   at Gallio.Runner.Reports.FileSystemReportContainer.OpenWrite(String path, String contentType, Encoding encoding) in c:\Server\Projects\MbUnit v3.2\Work\src\Gallio\Gallio\Runner\Reports\FileSystemReportContainer.cs:line 71
   at Gallio.Runner.Reports.DefaultReportWriter.SaveReport(AttachmentContentDisposition attachmentContentDisposition, IProgressMonitor progressMonitor) in c:\Server\Projects\MbUnit v3.2\Work\src\Gallio\Gallio\Runner\Reports\DefaultReportWriter.cs:line 171
   at Gallio.Icarus.Services.ReportService.SaveReportAs(Report report, String fileName, String format, IProgressMonitor progressMonitor)
   at Gallio.Icarus.Controllers.ReportController.GenerateReport(Report report, ReportOptions reportOptions, IProgressMonitor progressMonitor)
   at Gallio.Common.Concurrency.LockBox`1.Read(ReadAction`1 action) in c:\Server\Projects\MbUnit v3.2\Work\src\Gallio\Gallio\Common\Concurrency\LockBox.cs:line 61
   at Gallio.Icarus.Commands.RunTestsCommand.GenerateReport(IProgressMonitor progressMonitor)
   at Gallio.Icarus.Commands.RunTestsCommand.Execute(IProgressMonitor progressMonitor)
Reported by: 
UnhandledExceptionPolicy
   at Gallio.Common.Policies.EventHandlerPolicy.SafeInvoke[T](EventHandler`1 handlerChain, Object sender, T e) in c:\Server\Projects\MbUnit v3.2\Work\src\Gallio\Gallio\Common\Policies\EventHandlerPolicy.cs:line 69
   at Gallio.Common.Concurrency.Task.NotifyTerminated(TaskResult result) in c:\Server\Projects\MbUnit v3.2\Work\src\Gallio\Gallio\Common\Concurrency\Task.cs:line 305
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

What version of the product are you using? On what operating system?
Icarus 3.2.603.0 on Windows 7 x64

Please provide any additional information below.
Icarus is trying to create report in
C:\Users\Documents and Settings\Bender\Application Data\Gallio\Icarus\Reports
New projects correctly put their reports in
C:\Users\Documents and Settings\Jonathan\AppData\Roaming\Gallio\Icarus\Reports

Original issue reported on code.google.com by bender.oh@googlemail.com on 20 Nov 2010 at 2:04

GoogleCodeExporter commented 9 years ago
Are you running as an administrator?

Original comment by grahamr...@gmail.com on 21 Nov 2010 at 12:23

GoogleCodeExporter commented 9 years ago
Yes the user account is administrator. 
I think the problem is the Application Data folder not existing on Win 7

Original comment by bender.oh@googlemail.com on 21 Nov 2010 at 7:30

GoogleCodeExporter commented 9 years ago
Hmm, the reports directory comes from the project, and is usually relative. I 
wonder where it's getting the wrong app data folder from?

Original comment by grahamr...@gmail.com on 26 Feb 2011 at 1:52

GoogleCodeExporter commented 9 years ago
This project was originally developed on XP and then transferred to Win 7, the 
folder the project is looking for is the correct path on an XP system.

It does raise one point, what happens if you move a project between users, 
should the path stored be relative, rather than absolute?  

Original comment by Jonathan...@gmail.com on 27 Feb 2011 at 2:26

GoogleCodeExporter commented 9 years ago
The path should be relative to the project file location. Is it not?

Original comment by grahamr...@gmail.com on 28 Feb 2011 at 2:01

GoogleCodeExporter commented 9 years ago
The path should be referencing the APPDATA environment variable instead of the 
specific path string.

Original comment by sw.bzn...@gmail.com on 23 Jun 2011 at 8:18