locked
Pex and Moles:acess to \obj\Release\Moles\vd\m.g.snk' is denied RRS feed

  • Question

  • I have a fairly complex solution with some c++ (/CLR combiled) projects and some c# projects, referencing each other. Half of the Projects get a strong name. While I try to generate moles for 2 of the assemblies to be used in one test projekt I get a System.UnauthorizedAccessException while mole tries to access the  \obj\Release\Moles\vd\m.g.snk file.

    Here are my .moles settings for the two assemblies:

    <Moles Diagnostic="true" xmlns="http://schemas.microsoft.com/moles/2010/">
      <Assembly Name="MyAppBuilder" />
      <StubGeneration Disable="true" />
      <MoleGeneration Disable="false" />
      <!--<Compilation KeyFile="../../MyAppKey.snk" />-->
    </Moles>
    
    <Moles Diagnostic="true" xmlns="http://schemas.microsoft.com/moles/2010/">
    
      <Assembly Name="MyApp" />
      <StubGeneration Disable="true" />
      <MoleGeneration Disable="false" />
      <!--<Compilation KeyFile="../../MyAppKey.snk" />-->
    </Moles>

    And here is the log:

    ---------------------------
    30>  C:\Program Files\Microsoft Moles\bin\moles.exe MyAppBuilder.moles /forceintermediatepath /molesfilesonly /referenceassemblies:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.CSharp.dll;C:\Program Files\Microsoft Moles\PublicAssemblies\Microsoft.Moles.Framework.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll;D:\Products\MYAPP\Current\V5.X\Trunk\packages\NUnit.2.6.0.12054\lib\nunit.framework.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.DataSetExtensions.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.Linq.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\MyApp.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\MyAppBuilder.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\MyAppHL.dll" /referencedependentassemblies:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\PresentationFramework.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xaml.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\ABC.Core.ComponentModel.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Windows.Forms.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\WindowsBase.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\PresentationCore.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\ABC.Services.Parameters.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\WindowsFormsIntegration.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\ABC.Core.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.VersionControl.Client.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\ABC.Core.Globalization.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Windows.Presentation.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\Interop.Shell32.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Runtime.Serialization.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.Client.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.ServiceModel.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\Be.Windows.Forms.HexBox.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\ABC.Services.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\ABC.Core.License.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\MyAppLicense.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.VisualC.dll;C:\Program Files (x86)\Common Files\Microsoft Shared\ExtendedReflection\0.94.51023.0\bin\Microsoft.ExtendedReflection.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.ServiceModel.Web.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.VersionControl.Common.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.Common.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.WorkItemTracking.Client.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Services.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.VersionControl.Common.Integration.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Transactions.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Configuration.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.Design.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\WibuCmNET.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Management.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Security.dll;D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\ABC.Core.License.GUI.dll;C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.DirectoryServices.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.WorkItemTracking.Proxy.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.WorkItemTracking.Client.Provision.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.Common.Library.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.WorkItemTracking.Client.Cache.dll;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.WorkItemTracking.Client.RuleEngine.dll" /cachepath:"C:\Program Files\Microsoft Moles\bin\..\MolesAssemblies" /intermediatepath:D:\Products\MYAPP\Current\V5.X\Trunk\MyAppSystem\MyAppBuilder.Tests\obj\Release\Moles\vd /outputpath:D:\Products\MYAPP\Current\V5.X\Trunk\MyAppSystem\MyAppBuilder.Tests\MolesAssemblies /clrversion:v4.0.30319 /targetframeworkversion:v4.0 -- Success (0 - 0x0)
    30>  Microsoft Moles v0.94.51023.0 - http://research.microsoft.com/moles - .NET v4.0.30319
    30>  Copyright (c) Microsoft Corporation 2007-2010. All rights reserved.
    30>  
    30>  00:00:00.00> moles
    30>    Moles : info : configuration : diagnostic is on
    30>    Moles : info : metadata : loading D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\MyAppBuilder.dll
    30>    Moles : info : compilation : output assembly name: MyAppBuilder.Moles
    30>    Moles : info : code : found 433 types
    30>    Moles : info : code : visibility: exported or assembly(MyAppBuilder.Moles)
    30>  <?xml version="1.0" encoding="utf-8"?>
    30>  <Moles xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" CachePath="C:\Program Files\Microsoft Moles\bin\..\MolesAssemblies" Diagnostic="true" xmlns="http://schemas.microsoft.com/moles/2010/">
    30>    <Assembly Name="MyAppBuilder" Location="D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\MyAppBuilder.dll" />
    30>    <CodeStyle MaxIdentifierLength="256" />
    30>    <StubGeneration Disable="true">
    30>      <Types />
    30>    </StubGeneration>
    30>    <MoleGeneration>
    30>      <Types />
    30>    </MoleGeneration>
    30>    <Compilation>
    30>      <Reference FullName="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.CSharp.dll" />
    30>      <Reference FullName="Microsoft.Moles.Framework, Version=0.94.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Path="C:\Program Files\Microsoft Moles\PublicAssemblies\Microsoft.Moles.Framework.dll" />
    30>      <Reference FullName="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" />
    30>      <Reference FullName="nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" Path="D:\Products\MYAPP\Current\V5.X\Trunk\packages\NUnit.2.6.0.12054\lib\nunit.framework.dll" />
    30>      <Reference FullName="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" />
    30>      <Reference FullName="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.DataSetExtensions.dll" />
    30>      <Reference FullName="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.dll" />
    30>      <Reference FullName="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" />
    30>      <Reference FullName="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.dll" />
    30>      <Reference FullName="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll" />
    30>      <Reference FullName="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Path="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.Linq.dll" />
    30>      <Reference FullName="MyApp, Version=5.0.0.0, Culture=neutral, PublicKeyToken=2f3ae4698a6c0a34" Path="D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\MyApp.dll" />
    30>      <Reference FullName="MyAppBuilder, Version=5.0.0.0, Culture=neutral, PublicKeyToken=2f3ae4698a6c0a34" Path="D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\MyAppBuilder.dll" />
    30>      <Reference FullName="MyAppHL, Version=5.0.0.0, Culture=neutral, PublicKeyToken=2f3ae4698a6c0a34" Path="D:\Products\MYAPP\Current\V5.X\Trunk\Deploy\System32\Release\MyAppHL.dll" />
    30>    </Compilation>
    30>  </Moles>
    30>  
    30>  
    30>Moles : warning : cache : failed to compute assembly metadata hash
    30>    00:00:00.46> code generation
    30>      Moles : info : code : generating code at D:\Products\MYAPP\Current\V5.X\Trunk\MyAppSystem\MyAppBuilder.Tests\obj\Release\Moles\vd\m.g.cs
    30>      00:00:00.63> moles generation
    30>Moles : error : code : failed to generate mole for type ABC.MYAPP.Basis.Nodes.NodeReference`1
    30>Moles : error : code : failed to generate mole for type ABC.MYAPP.Basis.Design.MyAppBuilder
    30>Moles : error : code : failed to generate mole for type ABC.MYAPP.Basis.Design.HistoryManager`1
    30>Moles : error : code : failed to generate mole for type ABC.MYAPP.Basis.Design.SolutionBuilder
    30>Moles : error : code : failed to generate mole for type ABC.MYAPP.Basis.Design.ApplicationBuilder
    30>Moles : error : code : failed to generate mole for type ABC.MYAPP.Basis.Design.SubprojectHierarchyBuilder
    30>Moles : error : code : failed to generate mole for type ABC.MYAPP.Basis.Design.SubprojectInfoBuilder
    30>Moles : error : code : failed to generate mole for type ABC.MYAPP.Basis.Design.SubprojectBuilder
    30>Moles : error : code : failed to generate mole for type ABC.MYAPP.Basis.Design.SubprojectFileManager
    30>Moles : error : code : failed to generate mole for type ABC.MYAPP.Basis.Design.ModuleBuilder
    30>Moles : error : code : failed to generate mole for type ABC.MYAPP.Basis.Design.ViewState
    30>        Moles : info : code : generated 54 mole types
    30>    00:00:02.22> compiling
    30>  00:00:02.25> moles generator 11 errors, 1 warnings
    30>  Unexpected error, Access to the path 'D:\Products\MYAPP\Current\V5.X\Trunk\MyAppSystem\MyAppBuilder.Tests\obj\Release\Moles\vd\m.g.snk' is denied.
    30>  System.UnauthorizedAccessException: Access to the path 'D:\Products\MYAPP\Current\V5.X\Trunk\MyAppSystem\MyAppBuilder.Tests\obj\Release\Moles\vd\m.g.snk' is denied.
    30>     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    30>     at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
    30>     at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
    30>     at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
    30>     at System.IO.File.WriteAllBytes(String path, Byte[] bytes)
    30>     at Microsoft.Moles.Framework.Stubs.StubMetadata.WriteMolesKeyFile(String fileName)
    30>     at Microsoft.Moles.Engine.MolesDriver.ExecuteProtected()
    30>     at Microsoft.Moles.Engine.MolesDriver.Execute()
    30>     at Microsoft.Moles.MolesProgram.LaunchSingleMoles(MolesConsoleOptions options)
    30>     at Microsoft.Moles.MolesProgram.Main(String[] args)
    30>  
    30>  
    30>  
    30>  
    30>   Moles compilation FAILED - 2,7852396807165s
    30>C:\Program Files\Microsoft Moles\bin\Microsoft.Moles.targets(79,5): error MSB3073: The command ""C:\Program Files\Microsoft Moles\bin\moles.exe" @D:\Products\MYAPP\Current\V5.X\Trunk\MyAppSystem\MyAppBuilder.Tests\obj\Release\Moles\moles.args" exited with code -1002.
    31>


    http://bitbonk.spaces.live.com



    • Edited by bitbonk Sunday, April 29, 2012 12:12 AM
    Friday, April 27, 2012 11:02 AM

Answers