Does the Attribnute Class exist in the both the assemblies folders?, if so remove it from the folder that does not have the assembly in that does the reflection
-----Original Message----- From: Al Tech [mailto:[EMAIL PROTECTED] Sent: 30 January 2004 04:01 To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Asembly.LoadFrom() and custom attributes problem The CLR runs into an error if all of the following conditions apply: * There is a managed application app.exe together with a DLL fw.dll somewhere on the file system * There are two managed DLLs a.dll and b.dll somewhere else * In fw.dll there is a attribute class: MyAttribute * MyAttribute has a property of type Type: ItfType * a.dll contains an interface: IMyItf * b.dll contains a class that implements IMyItf: CMyClass * CMyClass has an attribute: [My(ItfType=typeof(IMyItf))] * app.exe loads b.dll via Assembly.LoadFrom("<path>\\b.dll") * app.exe retrieves custom attributes from type CMyClass via reflection: type.GetCustomAttributes() The call to GetCustomAttributes() crashes, because the containing assembly of IMyItf cannot be found. However, if I create a static property CMyClass.MyItfType that returns typeof(IMyItf), everything is fine. A CLR fusion bug (can't resolve dependencies in the LoadFrom context correctly)? =================================== This list is hosted by DevelopMentor(r) http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com ************************************************************************************************************************** Everything in this e-mail and attachments relating to the official business of MultiChoice Africa is proprietary to the company. Any view or opinion expressed in this message may be the view of the individual and should not automatically be ascribed to the company. If you are not the intended recipient, you may not peruse, use, disseminate, distribute or copy this message. If you have received this message in error, please notify the sender immediately by email, facsimile or telephone and destroy the original message. ************************************************************************************************************************** =================================== This list is hosted by DevelopMentor� http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com
