Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create component 'MetroButton' - .NET Core 5 #121

Open
robdplatt opened this issue Feb 3, 2021 · 0 comments
Open

Failed to create component 'MetroButton' - .NET Core 5 #121

robdplatt opened this issue Feb 3, 2021 · 0 comments

Comments

@robdplatt
Copy link

I have multiple WinForm projects that I've upgraded from .NET Framework 4.7.2 to .NET Core 5. The projects that referenced MetroModernUI controls failed to load in the designer - though they compiled and ran just fine.

If I tried to open the form in the designer it would open blank/white with no ability to interact with it.

I eventually found that if I removed my references to MetroButton, the form would load without issue.

If I drag the MetroButton control onto the form, I get the following error:

Failed to create component 'MetroButton'. The error message follows:

'System.InvalidCastException: Unable to cast object of type 'Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.ControlProxy`1[Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Bits`32[Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+On,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+On,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+On,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+On,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off,Microsoft.VisualStudio.WinForms.RemoteClient.Proxies.EncodedNumberType+Off]]' to type 'System.Windows.Forms.Control'.

   at System.Windows.Forms.Design.ControlDesigner.get_Control()
   at System.Windows.Forms.Design.ControlDesigner.Initialize(IComponent component)
   at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo)
   at System.ComponentModel.Design.DesignerHost.PerformAdd(IComponent component, String name)
   at System.ComponentModel.Design.DesignerHost.Add(IComponent component, String name)
   at Microsoft.VisualStudio.WinForms.RemoteClient.Utilities.ContainerHelpers.SynchronizeComponents(IContainer rootContainer, ComponentProxy[] components, String[] componentNames, String[] containerNames)
   at Microsoft.VisualStudio.WinForms.DesignerHostShim.SynchronizeWithSnapshot(DesignerHostSnapshot snapshot)
   at Microsoft.VisualStudio.WinForms.RemoteClient.Toolbox.WinFormsToolboxItem.CreateComponentsCore(IDesignerHost host, IDictionary defaultValues)
   at System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost host, IDictionary defaultValues)
   at Microsoft.VisualStudio.Windows.Forms.Design.OleDragDropHandler.CreateTool(ToolboxItem tool, ControlProxy parent, Int32 x, Int32 y, Int32 width, Int32 height, Boolean hasLocation, Boolean hasSize, ToolboxSnapDragDropEventArgs snapDragDropEventArgs)'

I haven't tried other controls.
My form is a MetroForm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant