SharePoint - Sorry something went wrong - an unexpected error occured. ULS Logs say "Unable to Cast Object"

Marc Cumos 126 Reputation points
2021-02-09T15:48:19.713+00:00

Hi All,

Really strange error I got today. Some other folks posted about something similar but weren't able to identify what caused this error.

Was able to resolve by IIS RESET, but just don't know why this happened.

Users were trying to hit the site this morning and got the "sorry, something went wrong" screen.

I checked the ULS logs and got the below. Any ideas on what these are? Never got them before.

Application error when access /Pages/default.aspx, Error=Unable to cast object of type 'Microsoft.SharePoint.WebControls.FeatureMenuTemplate' to type 'Microsoft.SharePoint.WebControls.ToolBarMenuButton'.  
 at T_ToolBarMenuButton_PrefixHtml_32.SetProperty(Object , Object )    
 at System.Web.Util.FastPropertyAccessor.SetProperty(Object target, String propName, Object val, Boolean inDesigner)    
 at System.Web.UI.ControlBuilder.SetSimpleProperty(SimplePropertyEntry entry, Object obj)

System.InvalidCastException: Unable to cast object of type 'Microsoft.SharePoint.WebControls.FeatureMenuTemplate' to type 'Microsoft.SharePoint.WebControls.ToolBarMenuButton'.   
 at T_ToolBarMenuButton_PrefixHtml_32.SetProperty(Object , Object )    
 at System.Web.Util.FastPropertyAccessor.SetProperty(Object target, String propName, Object val, Boolean inDesigner)    
 at System.Web.UI.ControlBuilder.SetSimpleProperty(SimplePropertyEntry entry, Object obj)


Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Web.HttpException (0x80004005): 'Site' could not be set on property 'FeatureScope'. ---> System.InvalidCastException: Unable to cast object of type 'Microsoft.SharePoint.WebControls.FeatureMenuTemplate' to type 'Microsoft.SharePoint.WebControls.ToolBarMenuButton'.    

Edit ---

This error occured early this morning around 2:41:00 AM EST.
I noticed in the event view, at 2:38:01 - that "A worker process with process id of '16400' serving application pool 'SharePoint Pool' has requested a recycle because it reached its scheduled recycle time."

Could this possibly have caused this error? Seems normal to me that the pool recycles daily.

Microsoft 365 and Office | SharePoint Server | For business
Microsoft 365 and Office | SharePoint Server | Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Chelsea Wu 6,341 Reputation points Moderator
    2021-02-10T04:55:52.847+00:00

    The message in Event Viewer you provide seems to be a notice instead of error. It is suggested to remove the automatic recycle or schedule a time for the daily recycling, which seems to be set in your farm already based on the event message.

    You can double check if you have set the schedule for recycling via IIS > Application Pool > Recycling... on the right sidebar, referring to this blog.

    If you want to find out the root cause of this issue, it is recommended to open a support ticket with Microsoft to have a dedicated Technical Professional to investigate, as we can only provide suggestions on troubleshooting in the forum.

    Please see the contact number for your region via this entrance: Global Customer Service phone numbers.

    *Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link. *


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    **Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. **


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.