Partager via


Exception has been thrown by the target of an invocation

"Exception has been thrown by the target of an invocation" error message when you try to create a project in Visual Studio 2015 IDE

Capture

As per the VS IDE log (ActivityLog.xml),

Construction of frame content failed. Frame identifier: ST:0:0:{74946827-37a0-11d2-a273-00c04f8ef4ff} Frame caption: Exception details: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Microsoft.VisualStudio.Shell.Interop.IVsShell5.LoadPackageWithContext(Guid& packageGuid, Int32 reason, Guid& context) at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.GetPackage() at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()

I also reviewed the DebugDiag trace. Considering above error message, one of the relevant call stacks was as mentioned below:

                Type: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Type: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Type: System.InvalidOperationException
Message: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.
Stack:
[GCFrame]
[GCFrame]
[HelperMethodFrame_PROTECTOBJ]
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])
System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
Roslyn.Utilities.SHA256CryptoServiceProvider..ctor()
Microsoft.CodeAnalysis.Diagnostics.Log.DiagnosticAnalyzerLogger..cctor()
[GCFrame]
[HelperMethodFrame]
Microsoft.CodeAnalysis.Diagnostics.Log.DiagnosticAnalyzerLogger.AllowsTelemetry(Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerService, Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer)
Microsoft.CodeAnalysis.Diagnostics.Log.DiagnosticLogAggregator.UpdateAnalyzerTypeCount(Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer, Microsoft.CodeAnalysis.Diagnostics.AnalyzerActions)

This problem occurs when the "FIPS-compliant algorithms" policy is enabled on a system. For more details: https://support.microsoft.com/en-in/kb/811833

Here, fipsalgorithmpolicy registry subkey was set to 1 (Enabled).

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy]
"Enabled"=dword:00000001

I disabled FIPS setting “Enabled” DWORD value to Zero.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy]
"Enabled"=dword:00000000

Then the problem was resolved. I was able to create projects in Visual Studio 2015 IDE.