首页 > 解决方案 > Orchard CMS:启用或禁用的模块不起作用

问题描述

我有一个使用 Orchard CMS (v.1.10.2.0) 构建的网站;我开发了一个自定义模块并安装了它,它正在工作,就像已经安装的其他模块一样。

我的问题是,从有时开始(我不确切知道从什么时候开始),如果我尝试启用或禁用一个模块,我总是遇到关于 JetBrains.Annotations 的错误(完整堆栈见下文)。

我无法调试站点(它发布在服务器上,它没有在我的机器上运行);任何人都知道我怎么能理解发生了什么问题?关于如何在不调试的情况下获得一些信息的任何建议?(我对果园很陌生)。

哎呀。出了点问题……抱歉 发生了未处理的异常,请求被终止。请刷新页面。如果错误仍然存​​在,请返回

发生一个或多个错误。

System.AggregateException:发生一个或多个错误。---> System.TypeLoadException:无法从程序集“Orchard.Framework,Version=1.10.2.0,Culture=neutral,PublicKeyToken=null”加载类型“JetBrains.Annotations.UsedImplicitlyAttribute”。在 System.ModuleHandle.ResolveType(RuntimeModule 模块,Int32 typeToken,IntPtr* typeInstArgs,Int32 typeInstCount,IntPtr* methodInstArgs,Int32 methodInstCount,ObjectHandleOnStack 类型)在 System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule 模块,Int32 typeToken,RuntimeTypeHandle[] typeInstantiationHandle ] methodInstantiationContext) 在 System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) 在 System.Reflection.CustomAttribute。2.CreateEntry(TKey k, Func2 获取)在 Orchard.Caching.Cache 2.<>c__DisplayClass3_0.<Get>b__0(TKey k) at System.Collections.Concurrent.ConcurrentDictionary2.AddOrUpdate(TKey key, Func 2 addValueFactory, Func3 updateValueFactory) 在 Orchard.Caching.Cache 2.Get(TKey key, Func2 获取)在 Orchard.Caching.CacheManagerExtensions.Get[TKey,TResult](ICacheManager cacheManager, TKey key, Boolean preventConcurrentCalls,Func 2 acquire) at Orchard.Environment.Extensions.ExtensionManager.<LoadFeatures>b__19_0(FeatureDescriptor descriptor) at Orchard.Caching.DefaultParallelCacheContext.TaskWithAcquireContext1.Execute() 在 System.Linq.Parallel.ArrayMergeHelper 1.ToArrayElement(Int32 index) at System.Linq.Parallel.ForAllOperator1.ForAllEnumerator 1.MoveNext(TInput& currentElement, Int32& currentKey) at System.Linq.Parallel.ForAllSpoolingTask2.SpoolingWork() 在 System.Linq.Parallel.SpoolingTaskBase.Work() 在 System.Linq.Parallel.QueryTask.BaseWork(对象未使用)在 System.Threading.Tasks.Task.Execute() --- 内部异常堆栈跟踪结束 --- 在 System.Linq.Parallel.QueryTaskGroupState.QueryEnd(Boolean userInitiatedDispose) 在 System.Linq.Parallel.DefaultMergeHelper 2.System.Linq.Parallel.IMergeHelper<TInputOutput>.Execute() at System.Linq.Parallel.MergeExecutor1.Execute[ TKey](PartitionedStream 2 partitions, Boolean ignoreOutput, ParallelMergeOptions options, TaskScheduler taskScheduler, Boolean isOrdered, CancellationState cancellationState, Int32 queryId) at System.Linq.Parallel.PartitionedStreamMerger1.Receive[TKey](PartitionedStream2 partitionedStream) at System.Linq.Parallel.ForAllOperator1.WrapPartitionedStream[TKey](PartitionedStream 2 inputStream, IPartitionedStreamRecipient1 收件人,布尔值 preferStriping,QuerySettings 设置)在 System.Linq.Parallel.UnaryQueryOperator 2.UnaryQueryOperatorResults.ChildResultsRecipient.Receive[TKey](PartitionedStream2 inputStream)在 System.Linq.Parallel.ScanQueryOperator 1.ScanEnumerableQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient1 收件人)在 System.Linq.Parallel.UnaryQueryOperator 2.UnaryQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient1 收件人)在 System.Linq.Parallel.QueryOperator 1.GetOpenedEnumerator(Nullable1 的 mergeOptions、Boolean suppressOrder、Boolean forEffect、QuerySettings querySettings) 在 System.Linq.Parallel.ForAllOperator 1.RunSynchronously() at System.Linq.Parallel.ArrayMergeHelper1.Execute() 在 System.Linq.Parallel.QueryOperator 1.ExecuteAndGetResultsAsArray() at Orchard.Caching.DefaultParallelCacheContext.RunInParallel[T,TResult](IEnumerable1 源、Func 2 selector) at Orchard.Environment.Extensions.ExtensionManager.LoadFeatures(IEnumerable1 featureDescriptors) 在 System .Linq.Enumerable.d__17 2.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() 在 System.Linq.Enumerable.WhereEnumerableIterator 1.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 来源) 在 Orchard.Modules.Controllers.AdminController.FeaturesPOST(FeaturesBulkAction bulkAction, IList 1 featureIds, Nullable1 force) 在 lambda_method(Closure , ControllerBase , Object[] ) 在 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary 2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 参数)在 System.Web.Mvc.Async.AsyncControllerActionInvoker.b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) 在 System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult 2.CreateEntry 2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() ---> (Inner Exception #0) System.TypeLoadException: Could not load type 'JetBrains.Annotations.UsedImplicitlyAttribute' from assembly 'Orchard.Framework, Version=1.10.2.0, Culture=neutral, PublicKeyToken=null'. at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit) at Orchard.Environment.Extensions.ExtensionManager.GetSourceFeatureNameForType(Type type, String extensionId) at Orchard.Environment.Extensions.ExtensionManager.LoadFeature(FeatureDescriptor featureDescriptor) at Orchard.Caching.Cache(TKey k, Func 2 acquire) at Orchard.Caching.Cache2.<>c__DisplayClass3_0.b__0(TKey k)在 System.Collections.Concurrent.ConcurrentDictionary 2.AddOrUpdate(TKey key, Func2 addValueFactory,Func 2.Get 3 updateValueFactory) at Orchard.Caching.Cache(TKey 键,Func2 acquire) at Orchard.Caching.CacheManagerExtensions.Get[TKey,TResult](ICacheManager cacheManager, TKey key, Boolean preventConcurrentCalls, Func2 获取)在 Orchard.Environment.Extensions.ExtensionManager.b__19_0(FeatureDescriptor 描述符)在 Orchard.Caching.DefaultParallelCacheContext.TaskWithAcquireContext 1.Execute() at System.Linq.Parallel.ArrayMergeHelper1.ToArrayElement(Int32 索引)在 System.Linq.Parallel.ForAllOperator 1.ForAllEnumerator1.MoveNext(TInput& currentElement,Int32& currentKey)在 System.Linq.Parallel.ForAllSpoolingTask`2.SpoolingWork() 在 System.Linq.Parallel.SpoolingTaskBase.Work() 在 System.Linq.Parallel.QueryTask.BaseWork(对象未使用) 在 System.Threading.Tasks.Task.Execute ()<---

标签: orchardcms

解决方案


我遇到过几次这个问题。问题是扩展管理器尝试加载包含对 JetBrains 注释类的引用的程序集(可能是自定义模块),这些注释类已编译到Orchard.Framework程序集中,但由于与包含同名类的其他程序集冲突而在某些时候被删除.

我找到的唯一解决方案是从自定义模块中删除 JetBrains 注释属性的所有用法。


推荐阅读