gpt4 book ai didi

c# - ReSharper inspectcode.exe 2016.3 抛出异常

转载 作者:行者123 更新时间:2023-11-30 14:24:17 33 4
gpt4 key购买 nike

我已经下载了 ReSharper 的 inspectcode.exe 2016.3 版,但即使“inspectcode.exe --help”也不能流畅运行并显示很多错误。

首先它打印“running...”,然后是五个异常,最后是帮助文本。

解决这个问题的方法是什么?使用 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"

最佳答案

按照 this article 中提到的步骤进行操作

Problem: you see a lot of exceptions like:

--- EXCEPTION #1/4 [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 def ault, 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 ClassName = System.NotSupportedException HResult = COR_E_NOTSUPPORTED=80131515

Solution:

  1. Open "Properties" window for "zip" file you downloaded from JetBrains site;
  2. Select "General" tab;
  3. Hit "Unblock";
  4. Extract files from the archive once again;

关于c# - ReSharper inspectcode.exe 2016.3 抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41698065/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com