MDI Designer View is showing HTML, instead of the form design - vb.net

I am not sure what is happened and have been searching for fixes all night. When I double click on the mdi form (or right click and select "View Designer") what appears, instead of the form designer view, is html. When attempting to debug, Visual Studio shows an error being thrown when attempting to create and instance of the form. The inner exception/stack trace is show below.
System.InvalidOperationException was unhandled Message="An error
occurred creating the form. See Exception.InnerException for details.
The error is: Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG))" Source="Blah" StackTrace:
at Blah.My.MyProject.MyForms.Create_Instance_[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at Blah.My.MyProject.MyForms.get_mdiBlah()
at Blah.mdiBlah.Main() in C:\Users\Home\Desktop\ClientSoftware\ClientSoftware\mdiBlah.Designer.vb:line
1
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext
activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext
activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
A few common fixes for this issue is:
Check and make sure the class name in the code behind is the same as
the class name in the designer code. Check.
Make sure that all references the project uses are included. Check.
A few other things that I, unfortunately, can not remember at this time.
I know this could be a fairly open-ended error. But I really need some direction on this, and hopefully it will serve also as a guide for someone else in the future.

Via #Hans Passant, the answer is: You are using an ActiveX control on your form that is no longer properly registered. Rerun its installer. Thanks Hans

Related

Can't view any Designer with a user Control on It

I'm using visual studios 2017, vb.net, winforms.
On every form that contains a user control I am getting the display:
"To prevent possible data loss before loading the designer, the following errors must be resolved:".
with the error message:
Error HRESULT E_FAIL has been returned from a call to a COM component.
I have tried creating a new user control and adding it to a new form and I get the same result. The display appears after reopening a form that has a user control on it.
The program itself works fine it's only the designer that I can not see.
I would appreciate any advice why this might be occurring as it doesn't seem to be code related.
It might possibly be related to me using resharper to remove any unused reference or me running it on my laptop (Also vs2017).
Thanks In Advance
The Stack Trace is:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.VisualStudio.LanguageServices.Implementation.Utilities.Exceptions.ThrowEFail()
at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.CodeTypeRef.LookupTypeSymbol()
at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.CodeTypeRef.get_TypeKind()
at EnvDTE.CodeTypeRef.get_TypeKind()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.GetUrtTypeFromVsType(CodeTypeRef vsType)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnTypePopulateMembers(Object sender, EventArgs e)
at System.CodeDom.CodeTypeDeclaration.get_Members()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.MergedCodeDomParser.CodeTypeDeclarationPopulator.OnPopulateMembers(Object sender, EventArgs e)
at System.CodeDom.CodeTypeDeclaration.get_Members()
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
Figure out the problem. For some reason there was a reference that pointed towards the project itself. The designer returned when I removed the reference.

Getting "Error HRESULT E_FAIL has been returned from a call to a COM component" VB

I am using Visual Studio Community 2015 to modify a VB 2013 project. Whenever I try to open my main Windows Form the "Error HRESULT E_FAIL has been returned from a call to a COM component" message happens. I can't modify the form at all. There's no code errors in debug that I can find.
I've tried several of the solutions found on the following if they looked like they applied to my situation:
Error HRESULT E_FAIL has been returned from a call to a COM component VS2012 when debugging
This is only happening on one of my VB forms in the solution. The other 2 forms are working fine.
Call Stack error:
Instances of this error (1)
1. Hide Call Stack
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.VisualStudio.LanguageServices.Implementation.Utilities.Exceptions.ThrowEFail()
at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.CodeTypeRef.LookupTypeSymbol()
at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.CodeTypeRef.get_TypeKind()
at EnvDTE.CodeTypeRef.get_TypeKind()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.GetUrtTypeFromVsType(CodeTypeRef vsType)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnTypePopulateMembers(Object sender, EventArgs e)
at System.CodeDom.CodeTypeDeclaration.get_Members()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.MergedCodeDomParser.CodeTypeDeclarationPopulator.OnPopulateMembers(Object sender, EventArgs e)
at System.CodeDom.CodeTypeDeclaration.get_Members()
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
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)
I'm going to rebuild the form as it's only one screen that is giving the error. There doesn't seem to be a good solution for this at this time.

ObjectDisposedException at form close

I have an app in visual studio 2005 sp1, implemented in motorola mc2100 with windows ce 6.0, the application works fine until you close it then gives an error:
Error:
vb_scansample2.exe (app name)
ObjectDisposedException
at
system.windows.forms.control.invokehelper(delegate method, boolean fsynchronous, object[] rgobjargs)
at
system.windows.forms.control.invokehelper(delegate method, object[] args)
at
symbol.barcode.ActionsEventFiringThread()
any help?
The barcode actions object is raising an event. That event is trying to update something in the UI, but the UI is already torn down. Wrap the event handler logic in a try/catch and ignore ObjectDisposedExceptions, or better yet, unhook the event when you're disposing.

Telerik RadMenu XAML designer error

I have a XAML page which correctly loads in the designer when you first open the page. One of the controls on the page is a Telerik RadMenu. If you click on one of the RadMenuItem's in the Visual Studio designer, it causes the following exception to be thrown.
Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
Stack Trace:
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.Collection_InsertValue[T](PresentationFrameworkCollection`1 collection, UInt32 index, CValue value)
at MS.Internal.XcpImports.Collection_InsertDependencyObject[T](PresentationFrameworkCollection`1 collection, UInt32 index, DependencyObject value)
at System.Windows.PresentationFrameworkCollection`1.InsertDependencyObject(Int32 index, DependencyObject value)
at System.Windows.Controls.UIElementCollection.InsertInternal(Int32 index, UIElement value)
InnerException: None
This stops the designer from working and the only way to get it working again is to close + reopen Visual Studio. Is this a bug with my XAML or is it a problem which needs reporting to Telerik / Microsoft?
This was caused by a bug in Visual Studio 2012. VS 2013 does not have the problem and VS 2012 update 4 fixed the issue.

Get an error System.ArgumentNullException was unhandled, Value Cannot be null. Parameter name: activationContext

I'm getting the following exception when I try to run up my Winforms app and haven't been able to find a solution to it:
System.ArgumentNullException was unhandled
Message=Value cannot be null.
Parameter name: activationContext
Source=mscorlib
ParamName=activationContext
StackTrace:
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
I've added a handler for the "unhandled error" event in the applicationevents class but it never reaches that stage and there is no source code running that I can break into and diagnose.
The application was fine until I added a user control (nothing fancy, just a standard windows user control) and then dragged it onto a form in the app (user control and form were in the same application). The application builds and compiles without any errors or warnings but when I attempt to run it up I get the above error straight away.
Does anyone have any idea what it could be or even how I can go about investigating it? I'm a bit stumped on this one as I'm not sure how to investigate it. I removed the user control from the form and then I removed the user control from the application entirely but the error hasn't gone away. In all honesty the addition of the user control might be a red herring but the problem manifested straight after adding it.
Hope someone can help.
try unchecking the Enable clickonce security settings checkbox in the security tab of the application properties(Projects Tab -> "Project Name" Properties-> Security Tab).
Try Build -> Clean Solution instead. I don't know why this isn't done automatically during a Build, but its no good complaining
I also had this problem in VS2010 VB.NET, Thanks Rene!
Unchecking project_properties.security.enable click once removed my problem
How my symptoms manifested:
I had a custom user control on a form, and was forced to remove any reference to it manually inside InitializeComponent() subroutine
reason:
my Winform had corrupted just after I modified the New() subroutine of my custom user control, where I changed the New() to add arg's and I didn't create a 'default' Sub New() with no arg's, as required for winform page rendering)
Just to give closure on this question the following resolved it:
Unchecked the "enable clickonce security settings" checkbox in the security tab of the application properties.
As suggested by Rene in the comments of my question.