DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

/API/internalservices/controlBar/ToggleUserMode

 3 Replies
 3 Subscribed to this topic
 28 Subscribed to this forum
Sort:
Author
Messages
New Around Here
Posts: 2
New Around Here

If we attempt to edit a page by clicking on the pencil icon or the edit page option through the page menu we receive the following error

An error has occurred.

An error occurred when trying to create a controller of type 'ControlBarController'. Make sure that the controller has a parameterless public constructor.

System.InvalidOperationException

 at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) at System.Web.Http.Tracing.Tracers.HttpControllerActivatorTracer.<>c__DisplayClass2.b__0() at System.Web.Http.Tracing.ITraceWriterExtensions.TraceBeginEnd(ITraceWriter traceWriter, HttpRequestMessage request, String category, TraceLevel level, String operatorName, String operationName, Action`1 beginTrace, Action execute, Action`1 endTrace, Action`1 errorTrace) at System.Web.Http.Tracing.Tracers.HttpControllerActivatorTracer.System.Web.Http.Dispatcher.IHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request) at System.Web.Http.Tracing.Tracers.HttpControllerDescriptorTracer.<>c__DisplayClass2.b__0() at System.Web.Http.Tracing.ITraceWriterExtensions.TraceBeginEnd(ITraceWriter traceWriter, HttpRequestMessage request, String category, TraceLevel level, String operatorName, String operationName, Action`1 beginTrace, Action execute, Action`1 endTrace, Action`1 errorTrace) at System.Web.Http.Tracing.Tracers.HttpControllerDescriptorTracer.CreateController(HttpRequestMessage request) at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()

An error has occurred.

Exception has been thrown by the target of an invocation.

System.Reflection.TargetInvocationException

 at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance[T]() at DotNetNuke.Framework.ServiceLocator`2.InitInstance() at System.Lazy`1.CreateValue() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Lazy`1.get_Value() at lambda_method(Closure , ServiceProviderEngineScope ) at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.GetInstanceOrActivator(HttpRequestMessage request, Type controllerType, Func`1& activator) at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)

An error has occurred.

The type initializer for 'DotNetNuke.ExtensionPoints.ExtensionPointManager' threw an exception.

System.TypeInitializationException

 at DotNetNuke.ExtensionPoints.ExtensionPointManager.ComposeParts(Object[] attributeParts) at DotNetNuke.Web.Components.Controllers.ControlBarController..ctor()

An error has occurred.

Could not load file or assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

System.IO.FileNotFoundException

 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(RuntimeAssembly assembly, RuntimeType caType) at Microsoft.Internal.AttributeServices.GetAttributes[T](ICustomAttributeProvider attributeProvider) at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog() at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetEnumerator() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at DotNetNuke.ExtensionPoints.SafeDirectoryCatalog..ctor(String directory) at DotNetNuke.ExtensionPoints.ExtensionPointManager.InitializeMefCompositionContainer() at DotNetNuke.ExtensionPoints.ExtensionPointManager..cctor()

 

We have attempted to remove all modules referencing version 5.0.0.0 of  System.Runtime.CompilerServices.Unsafe.dll and we have attempted editing the web.config of our site to reference version 5.0.0.0 of System.Runtime.CompilerServices.Unsafe.dll after copying version 5.0.0.0 of the System.Runtime.CompilerServices.Unsafe.dll, but the error persists.

We have resterted the site multiple times and cleared the cache. Any help anyone could provide would be greatly appreciated. Thank you.

New Around Here
Posts: 6
New Around Here

I had the same error.  It turned out to be references from other libraries we created for our modules.  Once I changed the references on those projects to make sure they were all referencing versions that are the same as DNN does, then I restored all of the DLLs that come from a base DNN install, then copy in our libraries and references but without replacing any existing files in the DNN bin folder, then everything worked and no more System.Runtime 5.0 errors.

Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!

That's fantastic advice... It's important to keep your references, .NET framework, and API endpoints all regularly updated to prevent unforeseen issues in the future.  :) 

Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!

By the way, I just discovered a "hacky" way to get the edit bar when this happens.  

  1. Be sure you're logged in already, if possible.  
  2. Open the web developer toolbar. 
  3. Navigate to Application (or wherever the cookies are). 
  4. Add a new cookie
    1. Name:  StayInEditMode
    2. Value:  YES
  5. Save the cookie.
  6. Refresh the page.  

That got me back in!  :) 

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved