In a simple app I'm working on, I've got three related assemblies:
Now, everything was going well and I could drop my control on tot he form in the designer, and it merrily added the relevant references, but when I try and actually run it under debug, I get:
System.TypeLoadException occurred
Message="Could not load type 'MyCompany.Geography.Windows.Forms.MyControl' from assembly 'MyCompany.Geography.Windows, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'."
Source="MyCompany.Geography.Windows"
TypeName="MyCompany.Geography.Windows.Forms.MyControl"
StackTrace:
at MyCompany.Geography.Windows.Form1.InitializeComponent()
at MyCompany.Geography.Windows.Form1..ctor() in ...\Projects\MyCompany.Geography\MyCompany.Geography.Windows\Form1.cs:line 10
InnerException:
Normally I'd go and look at the inner exception, but there is none. the bit that's really confusing me is that I'd have exepcted it to have followed the reference, and looked in there, and I'm a bit stuck as to what to check?
Make sure that the executable application references both MyCompany.Geography.Windows.Forms.dll and MyCompany.Geography.dll.
Have you checked the Output window during the debug session for any information about failing to load the assembly? It could also be related to conflicting versions of the assembly. When the application breaks into the debugger at the point of the exception, open the Modules window (Debug -> Windows -> Modules) and see if the assemblies are in fact loaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With