Posts

Showing posts from March, 2021

Microsoft Visual Studio designer cannot open and reports the error "The designer could not be shown for this file because none of the classes within it can be designed."

I had a problem today whereby I couldn't open the Visual Studio form designer and received the following error viewing any form or user control. The designer could not be shown for this file because none of the classes within it can be designed.  at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager) at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)  The solution was to rename the  ProjectAssemblies directory in the appropriate Visual Studio directory and reopen the project. It seems there was some kind of issue wi

Rendering ASP.NET C# CompositeControls and web controls with a tag such as a DIV instead of a SPAN tag.

I've recently had a problem with an ASP.NET composite control where I'd added some specific styles directly to the control. Weirdly .NET (4.6.2 in this case) would take the styles from the SPAN tag of the CompositeControl and apply them to the panels that these custom controls were in. Very strange. The simplest solution is to change the SPAN tag emitted by the CompositeControl to a DIV tag. This can be done by overriding the TagKey property. /// <summary> /// Gets the tag key for the control. /// </summary> protected override HtmlTextWriterTag TagKey {      get { return HtmlTextWriterTag.Div; } }