ShareThis

SharePoint 2013 MasterPage related Errors

Error: … allows a limit of 11 direct dependencies, and that limit has been exceeded

I was getting this error when I try to access my SharePoint site after deploying our latest master page.

Unexpected    System.Web.HttpException: The page '/_catalogs/masterpage/__DeviceChannelMappings.aspx' allows a limit of 11 direct dependencies, and that limit has been exceeded.

The reason for this error turns out to be the number of controls allowed on the page is exceeded the limit specified. This limit is specified in the web.config file as:

<SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="250" AllowPageLevelTrace="false">
   <PageParserPaths>
   </PageParserPaths>
</SafeMode>

By default the DirectFileDependencies limit is set to 10. Increasing the value as required will fix the issue.


Error: Cannot convert type 'Microsoft.SharePoint.WebControls.CssRegistration' to 'System.Web.UI.IAttributeAccessor'


I was getting this error after I edit my master page using SharePoint designer. When I go through the edited masterpage file, I noticed that there are some additional attributes added to some elements: __designer:Preview and __designer:Values.

<SharePoint:CssRegistration name="&lt;% $SPUrl:~sitecollection/_catalogs/masterpage/styles/Master. ...
  __designer:Preview="&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/_c...
  __designer:Values="&lt;P N=&#39;Name&#39; Bound=&#39;True&#39; T=&#39;SPUrl:~sitecollection/_cat...
<SharePoint:CssRegistration name="&lt;% $SPUrl:~sitecollection/_catalogs/masterpage/styles/Grid.cs...
  __designer:Preview="&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/_c...
  __designer:Values="&lt;P N=&#39;Name&#39; Bound=&#39;True&#39; T=&#39;SPUrl:~sitecollection/_cat...

To fix the issue, I had to search the whole master page file for __designer:Preview and __designer:Values attributes and remove them. So for the above example correct tag should be:

<SharePoint:CssRegistration name="&lt;% $SPUrl:~sitecollection/_catalogs/masterpage/OACCAC/styles/Master.css %&gt;" runat="server" after="SharepointCssFile"/>