Link to home
Start Free TrialLog in
Avatar of Econnergy
Econnergy

asked on

Runtime error in vb.net app: An unhandled exception of type 'System.TypeLoadException' occurred in...

I have a solution including approximately 20 projects. One of these projects (EscoRatePlanOffering.dll) is referenced (as a project) by 4 other projects. The solution compiles without a problem, but I am getting this runtime error when I try to instantiate an object that is referencing the dll and sometimes when I try to create an instance of the EscoRatePlanOffering object itself:
An unhandled exception of type 'System.TypeLoadException' occurred in rateplanmaint.dll
Additional information: Could not load type eco.TypedDataSets.EscoRatePlanOffering from assembly EscoRatePlanOffering, Version=1.0.2283.3213, Culture=neutral, PublicKeyToken=null.
 I tried removing the references to the dll, deleted all copies of the dll on my machine, and rereferenced the project (dll). I am still getting this runtime error and cannot figure out the source of the problem. I would greatly appreciate any assistance you can provide here. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of cubixSoftware
cubixSoftware

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Econnergy
Econnergy

ASKER

Hi,
Thanks for the reply. The EscoRatePlanOffering.dll does include a dataset. I will try recreating it and referencing the dll. What did you mean by it might be the DLL is okay but it is something inside it that it itself is trying to reference that could be the problem?
What I mean is your code is creating an instance of the EscoRatePlanOffering object and sometime you get the error. The natural assuption is it must be the DLL itself that is the problem but all I am trying to say is as EscoRatePlanOffering gets created, it itself might have references to other objects so when EscoRatePlanOffering is being created, it also then tries to create an instance to those objects it references and it is during this that an error occurs that then get propergated back and looks like it is the EscoRatePlanOffering object itself that is corrupt.

Thinks of it like a chain, your client object creates an instance of EscoRatePlanOffering object, but if EscoRatePlanOffering needs to reference Object A then it creates an instance of A, and if Object A references object B then A creates an instance of B, and if B references C then B creates C etc.etc.

All of this would happen when you create your instance to EscoRatePlanOffering object and any error at any point in this this chain would come back through the call stack looking for an error handler and if one is not found then it would break your application, right after the line of code that states "create EscoRatePlanOffering object"

Hi

Have you managed to resolve this or are you still having problems....
Thanks alot! I deleted the dataset and recreated it, and my problem has not recurred. I hope the issue is completely resolved, will let you know if it persists, but it seems fine. Thanks again.
The error just recurred. Any ideas? I didn't mention before - I also have a user control that is referenced by some of the projects in the solution, which references the EscoRatePlanOffering dll.
Thanks.