Unit Tests Failing on Visual Studio Team Services Build runner due to write permissions?

3

I have a build that is running on the Visual Studio Team Services and it runs a suite of XUnit tests that all pass on my local computer. The error has to do with loading a c++ dll (Interface.dll) that is referenced in my project. When they are run on the build server I get the following error

2015-12-18T17:40:24.3167397Z ##[error]Error Message:
2015-12-18T17:40:24.3197403Z ##[error]  Microsoft.Practices.Unity.ResolutionFailedException : Resolution of the dependency failed, type = "myapp.EntityModule.Entities.calc", name = "(none)".
2015-12-18T17:40:24.3197403Z ##[error]Exception occurred while: Calling constructor myapp.EntityModule.Entities.calc().
2015-12-18T17:40:24.3207417Z ##[error]Exception is: FileLoadException - Could not load file or assembly 'Interface.DLL' or one of its dependencies. The media is write protected. (Exception from HRESULT: 0x80070013)
2015-12-18T17:40:24.3217444Z ##[error]-----------------------------------------------
2015-12-18T17:40:24.3217444Z ##[error]At the time of the exception, the container was:
2015-12-18T17:40:24.3227399Z ##[error]
2015-12-18T17:40:24.3237398Z ##[error]  Resolving myapp.EntityModule.Entities.calc,(none)
2015-12-18T17:40:24.3237398Z ##[error]  Calling constructor myapp.EntityModule.Entities.calc()
2015-12-18T17:40:24.3247420Z ##[error]
2015-12-18T17:40:24.3247420Z ##[error]---- System.IO.FileLoadException : Could not load file or assembly 'Interface.DLL' or one of its dependencies. The media is write protected. (Exception from HRESULT: 0x80070013)
2015-12-18T17:40:24.3257416Z ##[error]Stack Trace:
2015-12-18T17:40:24.3267400Z ##[error]   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
2015-12-18T17:40:24.3267400Z ##[error]   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable`1 resolverOverrides)
2015-12-18T17:40:24.3277398Z ##[error]   at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides)
2015-12-18T17:40:24.3277398Z ##[error]   at Microsoft.Practices.Unity.UnityContainerExtensions.Resolve[T](IUnityContainer container, ResolverOverride[] overrides)
2015-12-18T17:40:24.3287422Z ##[error]   at myapp.EntityModule.Tests.Entities.Car.OutingSetup.OutingsetupTests.GetNewcalc()
2015-12-18T17:40:24.3297428Z ##[error]   at myapp.EntityModule.Tests.Entities.Car.OutingSetup.OutingsetupTests.OutingSetups_Ready_Rule_CasterSlugFrontInRangeWithUpperControlArmForeAdjLength_Right_TestReadyStatusValues(String simDescription, Double casterSlugFront, Double mountAdjustmentLengthFore, ReadyStatus expected)
2015-12-18T17:40:24.3297428Z ##[error]----- Inner Stack Trace -----
2015-12-18T17:40:24.3307426Z ##[error]   at myapp.EntityModule.Entities.Results.DymolaResults..ctor()
2015-12-18T17:40:24.3307426Z ##[error]   at myapp.EntityModule.Entities.calc..ctor()
2015-12-18T17:40:24.3317440Z ##[error]   at lambda_method(Closure , IBuilderContext )
2015-12-18T17:40:24.3317440Z ##[error]   at Microsoft.Practices.ObjectBuilder2.DynamicBuildPlanGenerationContext.<>c__DisplayClass1.<GetBuildMethod>b__0(IBuilderContext context)
2015-12-18T17:40:24.3327420Z ##[error]   at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context)
2015-12-18T17:40:24.3337422Z ##[error]   at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
2015-12-18T17:40:24.3347418Z ##[error]   at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)

Any thoughts on how to resolve this?

c#
visual-studio
tfsbuild
xunit
azure-devops
asked on Stack Overflow Dec 18, 2015 by PlTaylor • edited Mar 26, 2016 by Daniel Mann

1 Answer

0

If you are using Hosted Agents, you have to know that builds are launch without admin rights but I suspect your issue is related to something that is on your machine and not on their environments.

To attempt to reproduce, you can launch an Azure VM with just VS 2015 and your code and attempt to run the same command. You might be able to reproduce and pinpoint your error:)

answered on Stack Overflow Oct 11, 2016 by Tomap

User contributions licensed under CC BY-SA 3.0