0

When compiling a project with a Postsharp MethodInterceptionAspect, I get the following error:

Unhandled exception (postsharp-net40-x86-srv.exe release | .NET Framework 4.7.1): System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
      at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
      at ^nIsIyZ7TTJqY.GetKeyInfo(^8gP93Xsl\+Imn _0)
      at ^Up6wxUIUnN6a.^3w8852HL()
      at ^Up6wxUIUnN6a.^VfvrABjR()
      at ^Up6wxUIUnN6a.^SkiT()
      at ^Up6wxUIUnN6a.^8KD6D2SV(String _0)
      at ^cyC/TYSlPGB/.^wvPm(^RtksFin57NJ8 _0, ^8gP93Xsl\+Imn _1)
      at PostSharp.Sdk.Extensibility.Tasks.CompileTask.Execute()
      at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase)
      at PostSharp.Sdk.Extensibility.Project.Execute()
      at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
      at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation).

I'm not running Visual Studio (and do not want to) as admin.

This possible solution did not work: https://stackoverflow.com/a/43182648/201019

When I do run VS ad admin, I have no issue.

I have tried changing the project targeting framework from 4.6.1 to 4.5.1 to no avail.

Robert Sirre
  • 672
  • 1
  • 8
  • 28
  • If you try to build with `PostSharpHost` MSBuild property set to `Native`, does it happen as well? Does it happen with any version of PostSharp or just with some specific version? Are there more users on the same machine using PostSharp? – Antonín Procházka Feb 06 '18 at 14:18
  • I'll try the 'PostSharpHost' setting and changing the PostSharp version. No I'm the only user in this machine. What did resolve the issue was stopping signing the assemblies. – Robert Sirre Feb 10 '18 at 10:25
  • Would it be possible to obtain a project reproducing this issue, so we at PostSharp can figure out the root cause? – Antonín Procházka Feb 11 '18 at 23:32
  • 1
    Hi @AntonínProcházka, I managed to reproduce the error described above in a simple project using `OnExceptionAspect` just as the shown in the following link: https://www.infoworld.com/article/3048204/application-development/how-to-program-using-postsharp-in-c.html How can I send you my test? – Mario Puglisi Feb 13 '18 at 09:33
  • If you can reproduce it just by this "Hello World" example, I'm afraid it would be related to a corrupted development environment, so it wouldn't be possible to reproduce this issue on another machine. You can prove this assumption by building your project on another machine. – Antonín Procházka Feb 14 '18 at 09:41
  • The exception is E_ACCESSDENIED error is returned by either [ICLRStrongName::StrongNameGetPublicKey method](https://learn.microsoft.com/en-us/dotnet/framework/unmanaged-api/hosting/iclrstrongname-strongnamegetpublickey-method) or [ICLRStrongName::StrongNameSignatureSize method](https://learn.microsoft.com/en-us/dotnet/framework/unmanaged-api/hosting/iclrstrongname-strongnamesignaturesize-method), neither of which has this error code specified closer. – Antonín Procházka Feb 14 '18 at 09:41

0 Answers0