I have a webservice application and the following code:
private static Type buildType(string fullNameClass) { Type autType = null; AppDomain app = AppDomain.CurrentDomain; foreach(Assembly assembly in app.GetAssemblies()) { autType = assembly.GetType(fullNameClass); if(autType != null) break; } return autType; } |
The problem is that sometimes the app.GetAssemblies() does not return the DLL
expected. Its find the DLL for about an hour and then stop.
Thank for any help.
Jean PaulPosted Jan 25, 2011, 4:10 AM
This seems to be an interesting problem.
Probably, as a check you can create a piece of code that verifies whether the file exists
using the File.Exists() method and writing to an event log the status.
So once after one hour you should be getting the status file is not existing.
Regards,
Jean Paul
DiegoPosted Jan 24, 2011, 6:02 PM
It's do not solve my problem, i still receive the same error message after 1 hour.
Thanks for your help.
Jean PaulPosted Jan 24, 2011, 10:15 AM
I have no clue on how the GetAssemblies() is not working.
But i can prefer the following solution.
1. Iterate through each dll file in your folder using a for loop
2. Use Assembly.LoadFile() method to load the file and get the Assembly object
3. Create type from the above Assembly object
Please let me know it solves/not
Regards,
Jean Paul