Tuesday, December 8, 2015

Exception Message: Access to the path ...packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll' is denied

Hi all!
I founded bug in Team Foundation Server 2015.
An today I share the reason.
So the problem connect with build engineers who has TFS 2015 and XAML build definitions.

If you have VNext build definitions, you can try fix build in this article:

http://www.codewrecks.com/blog/index.php/2015/03/16/running-nunit-tests-in-a-tfs-2015-build-vnext/


But if you have big infrastructure, and you can't migrate in one moment to VNext, this is article for you.
So, I want show the investigate process.
1) You have build definition with NUnit tests. You install in nugget manager in VS NUnit test adapter, that tests will execute in TFS. First execute. WOW! Build was green. It's success!
2) Check-in some code, and after few second build fail with error:


Get sources from Team Foundation Version Control
Access to the path 'D:\---\src\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll' is denied.
Exception Message: Access to the path 'D:\---\src\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll' is denied. (type UnauthorizedAccessException) Exception Stack Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.InternalDelete(String path, Boolean checkHost) at Microsoft.TeamFoundation.Common.FileSpec.DeleteFile(String path, Boolean throwExceptionOnFailure) at Microsoft.TeamFoundation.Common.FileSpec.DeleteDirectoryInternal(String path) at Microsoft.TeamFoundation.Common.FileSpec.DeleteDirectoryInternal(String path) at Microsoft.TeamFoundation.Common.FileSpec.DeleteDirectoryInternal(String path) at Microsoft.TeamFoundation.Common.FileSpec.DeleteDirectoryInternal(String path) at Microsoft.TeamFoundation.Common.FileSpec.DeleteDirectory(String path, Boolean recursive, Boolean handleLongPaths) at Microsoft.TeamFoundation.Build.Workflow.Activities.DeleteDirectory.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
 
What?! Who was blocked file?
3) Investigate. If you try manually delete src folder, you will found that it's impossible.
If we look with utility "LockHunter" this file, we discovered, that this file lock: service: TFSBuildServiceHost.2013.
Ok. Please reboot machine, and you can again start build definition successfully. But after this situation repeat( look second point).
So, I think this is bug from Microsoft.
Because, if you uninstall 2015 tfs and install tfs 2013 agent  with Update 5, all build definition's with NUnit tests will be success.
 

2 comments:

  1. Did you find a solution to this problem?

    ReplyDelete
  2. No. We think, that this issue will fix Update 1 to TFS. But for current moment we still build such projects in Build agent 2013 .

    ReplyDelete