Recently, "out of nowhere", I'm getting an exception when trying to design a previously perfectly openable form in Visual Studio 2017:
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I also get one or multiple call stack errors:
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkPropertyDescriptor.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)
I'm really confused, sine other dialogs work perfectly and the erroneous dialog worked until yesterday, too.
Compiling and running the application both works successfully.
After trying the solutions of a similar question, I still have no luck resolving this.
My question:
Any idea how to analytically proceed to get to the root cause of this error?
Update 1:
I'm not (only) looking for a direct solution, but preferably for some reliable way of how to get to the root cause of the exception.
From the stack trace, I have no clue what even might cause it.
Update 2, solution:
Thanks to your comments, I was able to solve it by starting a second instance of Visual Studio and attaching it to the first one, thus debugging the first one.
I then enabled the Exception Settings to break on all CLR exceptions (in the second VS instance) and opened the erroneous form in Windows Forms Designer in the first VS instance.
The debugger then stopped at the location where the actual FileLoadException occurred.
I then was able to resolve it by removing some of my own logging code in a base control class that seems to work incorrectly when being ran from within VS WinForms Designer.
I will not delete my question here, since it may serve to others (and myself) as a further reference when googling for the initial error message I've got.