Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WinForms ElementHost Error

I am building a set of WPF controls on the side of my WinForms application so that I can convert the entire project over to WPF eventually. I am using the WinForms ElementHost module and setting my WPF controls inside of it.

Here is my issue, I am already hosting a plethora of WPF controls on the WinForms application through the ElementHost. However, I come across this one control and it tells me:

Error setting value'Assembly.MyCustomControl' to property 'Child'. Details: 
Could not load type 'Assembly.MyCustomControl' from assembly 'Assembly'......

Again I am loading several other controls into this project in the same fashion without fail. There are absolutely no errors on the library that is hosting the control. I am at such a loss here.

This error also ends up showing on the WinForms designer after I try to set the ElementHost to the control.

at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at System.UnitySerializationHolder.GetRealObject(StreamingContext context)
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertyAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement, CodePropertyReferenceExpression propertyReferenceEx, Boolean reportError)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement) 

Edit

I will post this as an answer later, but restarting Visual Studio fixed the problem...

like image 536
meanbunny Avatar asked Jan 17 '23 02:01

meanbunny


1 Answers

You just need to restart Visual Studio.

like image 112
Carlos Avatar answered Feb 07 '23 14:02

Carlos