WinForms ElementHost Error

I am creating a set of WPF controls on the side of my WinForms application to ultimately convert the entire project to WPF. I use the WinForms ElementHost module and install my WPF controls inside it.

Here is my problem. I already have many WPF controls in a WinForms application through 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 load several other controls into this project in the same way. There are no errors in the library where the control is hosted. I'm here with such a loss.

This error also ends up showing up in the WinForms designer after I try to set the ElementHost element 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 send this as an answer later, but restarting Visual Studio fixed the problem ...

+4
source share
1 answer

You just need to restart Visual Studio.

+9
source

Source: https://habr.com/ru/post/1403496/


All Articles