Tag: error

Visual Studio 2017 Extension Load Error

After installing quite a few extensions by using the Extensions and Updates command on the Tools menu, I started to get a load error every time I opened Visual Studio, telling me to check the ActivityLog.xml in the C:\Users\…\AppData\Roaming\Microsoft\VisualStudio\15.0_709865ab folder. I opened the file and found numerous entries like this one:

System.ComponentModel.Composition.ImportCardinalityMismatchException: Duplicate EditorFormatDefinition exports with identical name attributes exist. Duplicate name is PowerShell Interactive – Black

I suggested to me I had to check for duplicate extensions, and I had indeed installed two editions of the same extension, PowerShell Tools for Visual Studio 2017 as well as the old one, PowerShell Tools for Visual Studio 2015. Uninstalling the latter solved the issue. 🙂

Advertisements

The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>).

I am developing a data entry application in Visual Studio 11 Beta, by using the ASP.NET Dynamic Data Entities Web Application project template. I decided to add the ASP.NET Menu control to the Site.master master page, but then I started getting this error, The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>).

While the error more or less tells you where things go wrong, the stack trace looks like this:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>).]
   System.Web.UI.ControlCollection.Add(Control child) +9719987
   System.Web.UI.WebControls.MenuRendererStandards.AddStyleBlock() +61
   System.Web.UI.WebControls.MenuRendererStandards.PreRender(Boolean registerScript) +89
   System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e) +238
   System.Web.UI.Control.PreRenderRecursiveInternal() +83
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974

Okay, so the rendering isn’t quite working. I did a quick search for this error and found that a lot of developers have had this issue over the years, so definitely nothing to do with the .NET Framework 4.5 or VS11 Beta. What fixed the issue was to move the script element, <script src="<%: ResolveUrl("~/Scripts/modernizr-2.0.6-development-only.js") %>"></script> out of the head element and into the body element. Very simple fix…