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.
Related
In VS Studio Express 2017, 2019, and 2022 I get an error "Input string was not in a correct format" at design time when trying to inherit a form. I can view the form I am inheriting from at design time, but not the form that is doing the inheriting. There is no error line number specified and the call stack shows:
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)
At this time there is no code in the inherited form and there are no controls on the form itself since I can't look at the form. Actually, I can look at the form if I remove the Inherit statement. Also, the program compiles and runs correctly.
I am completely stumped and have no idea how to find the error. All my searches have come up with run time errors. I have a feeling it's a MS bug or a corrupted file somewhere.
Any ideas on how to find my problem?
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.
I have a MDI (IsMdiContainer = True) Visual Basic .NET form in Visual Studio 2013 which is based on a System.Windows.Forms.Ribbon. It contains several RibbonTabs with RibbonPanels and RibbonButtons in them. If I make one of those panels (containing two buttons) not visible at design-time, I can not load the form at design-time anymore. The code the designer adds at the *.Designer.vb file is:
Me.pnl_accions_llistats.Visible = False
Which produces this error message:
Exception of type 'System.ComponentModel.Design.ExceptionCollection'
was thrown.
Any idea on how to solve that besides removing the offending panel and their buttons? Found that using the offending line at *.vb in the Load event, works fine but I'm worried about the designer crashing that way.
I tried the solution suggested here but Visual Studio didn't show me any error when opening the form at design-time. However, using source control, I could easily identify the designer line of code that crashes the form.
The only solution I found was using the offending line in the Load event at *.vb.
I am trying to show association relationships in my code using the Class Designer in Visual Studio 2015 (VB.NET). I am right clicking properties in my class and selecting Show as Association, which works correctly, and shows the association arrow.
However, when I try to use Show as Collection Association to show my many-to-one associations, I see the following dialog:
Error Dialog
I have searched for Error HRESULT E_FAIL has been returned from a call to a COM component, but the common issues with this seem to be during compilation, or issues with the designer. Others with this problem report it appearings in the output window, rather than pop up in a message box like my error.
Things I have tried:
repairing Visual Studio from Programs and Features in the Control Panel
Creating a new class diaram, and trying to use the Collective Association feature
suggestions from this thread: Error HRESULT E_FAIL when pasting references in Visual Studio
Any help with this issue would be much appreciated!
I had the exact same error trying to show a class diagram for a Xamarin.iOS project, while my Portable Class Libraies worked fine.
My low tech solution was to copy my classes to a temporary class library and make the diagram there...
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.