ReSharper inspectcode.exe 2016.3抛出异常

时间:2017-01-17 13:09:05

标签: c# .net command-line resharper

我已经下载了ReSharper的inspectcode.exe版本2016.3,但是甚至" inspectcode.exe - help"没有顺利运行并显示许多错误。

首先它打印"运行...",然后是五个例外,最后是帮助文本。

可以解决这个问题的方法是什么?对于9.1.1版本,没有任何问题。

inspectcode.exe的输出--help

PS C:\somefolder> .\inspectcode.exe --help
JetBrains Inspect Code 2016.3.1
Running in 64-bit mode, .NET runtime 4.0.30319.42000 under Microsoft Windows NT 6.2.9200.0
Component JetBrains.Application.SinceClr4.Extensions.JetPackageRepositoryFactoryEnvironmentComponent [Singleton, Corrupted] construction has failed. Could not bind a part catalog assembly "JetBrains.Platform.Shell.SinceClr4, Version=107.0.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325" by loading from file C:
\inspectcodeFolder\JetBrains.Platform.Shell.SinceClr4.dll. Could not load file or assembly 'file:///C:\inspectcodeFolder\JetBrains.Platform.Shell.SinceClr4.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515.) An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

--- EXCEPTION #1/5 [NotSupportedException]
Message = "An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information."
ExceptionPath = Root.InnerException.InnerException.InnerException.InnerException
ClassName = System.NotSupportedException
HResult = COR_E_NOTSUPPORTED=80131515

--- Outer ---

--- EXCEPTION #2/5 [FileLoadException]
Message = "Could not load file or assembly 'file:///C:\inspectcodeFolder\JetBrains.Platform.Shell.SinceClr4.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
ExceptionPath = Root.InnerException.InnerException.InnerException
ClassName = System.IO.FileLoadException
InnerException = "Exception #1 at Root.InnerException.InnerException.InnerException.InnerException"
HResult = COR_E_NOTSUPPORTED=80131515
Source = mscorlib
FileLoad_FileName = file:///C:\inspectcodeFolder\JetBrains.Platform.Shell.SinceClr4.dll
StackTraceString = "
  at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
     at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
     at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
     at System.Reflection.Assembly.LoadFrom(String assemblyFile)
     at JetBrains.Application.Bindings.AssemblyMasterBinderOnDiskFiles.JetBrains.Application.Bindings.IAssemblyMasterBinder.BindToRuntimeAssembly(AssemblyNameInfo name, OnError onerror)
"

--- Outer ---

--- EXCEPTION #3/5 [InvalidOperationException]
Message = "Could not bind a part catalog assembly "JetBrains.Platform.Shell.SinceClr4, Version=107.0.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325" by loading from file C:\inspectcodeFolder\JetBrains.Platform.Shell.SinceClr4.dll."
ExceptionPath = Root.InnerException.InnerException
ClassName = System.InvalidOperationException
InnerException = "Exception #2 at Root.InnerException.InnerException.InnerException"
HResult = COR_E_INVALIDOPERATION=80131509
Source = JetBrains.Platform.Util
StackTraceString = "
  at JetBrains.Util.OnError.<.cctor>b__18(Exception ex)
     at JetBrains.Application.Bindings.AssemblyMasterBinderOnDiskFiles.JetBrains.Application.Bindings.IAssemblyMasterBinder.BindToRuntimeAssembly(AssemblyNameInfo name, OnError onerror)
     at JetBrains.Application.Table.TablePartCatalogStorage.<>c__DisplayClass8.<.cctor>b__3(Int32`1 tk)
     at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
     at JetBrains.Application.Table.TablePartCatalogStorage.TypeBind(Int32`1 token)
     at JetBrains.Application.Extensibility.PartCatalogTypeComponentDescriptor.CreateInstance(IValueResolveContext context)
     at JetBrains.Application.Components.SingletonDescriptor.CreateInstanceChecked(OnError onError, IComponentContainer container)
     at JetBrains.Application.Components.SingletonDescriptor.GetValue()
     at JetBrains.Application.Components.InitializationStrategyDefault.Schedule(Lifetime lifetime, ICollection`1 dscs)
"

--- Outer ---

--- EXCEPTION #4/5 [TargetInvocationException]
Message = "Component JetBrains.Application.SinceClr4.Extensions.JetPackageRepositoryFactoryEnvironmentComponent [Singleton, Corrupted] construction has failed."
ExceptionPath = Root.InnerException
ClassName = System.Reflection.TargetInvocationException
InnerException = "Exception #3 at Root.InnerException.InnerException"
HResult = COR_E_TARGETINVOCATION=80131604

--- Outer ---

--- EXCEPTION #5/5 [LoggerException]
Message = "Component JetBrains.Application.SinceClr4.Extensions.JetPackageRepositoryFactoryEnvironmentComponent [Singleton, Corrupted] construction has failed."
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = "Exception #4 at Root.InnerException"
HResult = COR_E_APPLICATION=80131600
StackTraceString = "
  at JetBrains.Util.Logging.Logger.LogException(Exception ex)
     at JetBrains.Application.Components.InitializationStrategyDefault.Schedule(Lifetime lifetime, ICollection`1 dscs)
     at JetBrains.Application.Components.ComponentStorage.ComposeDescriptors(ICollection`1 descriptors)
     at JetBrains.Application.Components.ComponentStorage.Compose()
     at JetBrains.Application.Environment.JetEnvironment..ctor(Lifetime lifetime, JetHostParametersCaller host)
     at JetBrains.Application.Environment.JetEnvironment.<>c__DisplayClasse.<InternalCreate>b__b()
     at JetBrains.Threading.ReentrancyGuard.Execute(String name, Action action)
     at JetBrains.Application.Environment.JetEnvironment.InternalCreate(LifetimeDefinition lifetimeDefinition, JetHostParametersCaller host, JetEnvironment& environment)
     at JetBrains.Application.Environment.JetEnvironment.CreateAndRun(Full hostparams)
     at JetBrains.CommandLine.Common.Console.Application.CommandLineProgram.Main(Assembly assembly, Type environmentZoneType, HostInfo hostInfo, IProductInfo productInfo, String[] args)
     at JetBrains.CommandLine.Common.Console.Application.CommandLineProgram.<Run>b__1[TZone,TProductInfo](RunnerContext ctx)
"

Usage: InspectCode.exe [options] [project file]
Options:
  --config : Path to configuration file where parameters are specified (use 'config-create' option to create sample file).
  --config-create : Write command line parameters to specified file.
  --toolset : MsBuild toolset version. Highest available is used by default. Example: --toolset=12.0.
  --output (-o) : Write inspections report to specified file.
  --format (-f) : Write inspections report in specified format (Xml, Html, Txt).
  --absolute-paths (-a) :

Use absolute paths in inspections report (default: False).
  --no-swea : Force disable solution-wide analysis (default: False).
  --swea : Force enable solution-wide analysis (default: False).
  --project : Analyze only projects selected by provided wildcards (default: analyze all projects in solution).
  --profile (-p) : Path to the file to use custom settings from (default: Use R#'s solution shared settings if exists).
  --no-buildin-settings : Suppress global, solution and project settings profile usage. Alias for --disable-settings-layers:GlobalAll;GlobalPerProduct;SolutionShared;SolutionPersonal;ProjectShared;ProjectPersonal (default: False).
  --disable-settings-layers (-dsl) : Disable specified settings layers. Possible values: GlobalAll, GlobalPerProduct, SolutionShared, SolutionPersonal, ProjectShared, ProjectPersonal.
  --caches-home : Path to the directory where produced caches will be stored.
  --debug (-d) : Show debugging messages (default: False).
  --help (-h) : Show help and exit.
  --version (-v) : Show tool version and exit.
  --eXtensions (-x) : Install and use specified extensions.
  --properties : MSBuild properties.
  --targets-for-references : MSBuild targets. These targets will be executed to get referenced assemblies of projects..
  --targets-for-items : MSBuild targets. These targets will be executed to get other items (e.g. Compile item) of projects..
  --dumpIssuesTypes (-it) : Dump issues types (default: False).
Example:
  InspectCode.exe --caches-home="C:\Temp\Cache" -o="report.xml" "C:\src\MySolution.sln"

1 个答案:

答案 0 :(得分:6)

按照this article

中提到的步骤操作
  

问题:您会看到很多例外情况:

     

--- EXCEPTION#1/4 [NotSupportedException] Message =&#34;尝试从网络位置加载程序集   导致程序集在以前版本的.NET中被沙箱化   框架。此版本的.NET Framework不启用CAS   由def ault制定的政策,所以这种负担可能是危险的。如果没有这个负载   打算沙箱组装,请启用   loadFromRemoteSources切换。看到   http://go.microsoft.com/fwlink/?LinkId=155569了解更多信息。&#34;   ExceptionPath = Root.InnerException.InnerException.InnerException   ClassName = System.NotSupportedException HResult =   COR_E_NOTSUPPORTED = 80131515

     

解决方案:

     
      
  1. 打开&#34;属性&#34; &#34; zip&#34;的窗口您从JetBrains下载的文件   位点;
  2.   
  3. 选择&#34; General&#34;标签;
  4.   
  5. 点击&#34;取消阻止&#34 ;;
  6.   
  7. 再次从存档中提取文件;
  8.   
相关问题