I'm using Assembly.LoadFrom as the assemblies are "Add-Ins" that reside on a
shared folder where they are used by both the front end and a back end
component, the Custom attribute class is compiled into a single assembly and
not separately for each object.

I will try to see what happens if all of the files are placed into a single
folder, however that is not a perfect solution

-----Original Message-----
From: Eric Gunnerson [mailto:[EMAIL PROTECTED]
Sent: 23 January 2004 08:23
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Casting Problem

Assembly.Load should give you the same identity.

Assembly.LoadFrom() *may* give you a different identity, though the
runtime will try an assembly.Load() first, and if that succeeds, it
would have the same identity.

I'm presuming that the custom attribute class only exists in one dll,
and that you aren't compiling it separately into different assemblies.

-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Heath Ryan
Sent: Friday, January 23, 2004 8:30 AM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Casting Problem

 Hi Paul,

Just a wild guess,

Are you using Assembly.Load ?
And those assemblies are within different directories
than your application?

Assemblies (different directory) explicitly loaded with this function
are not considered the same as the assemblies (app directory)
that were loaded implicitly by the CLR.

HTH
// Ryan

-----Original Message-----
From: Paul Stevens
To: [EMAIL PROTECTED]
Sent: 1/23/2004 1:03 PM
Subject: [ADVANCED-DOTNET] Casting Problem

I've got a very weird problem,



Basically I have the following setup,



1.      a Custom attribute class
2.      a DLL that uses the custom attribute
3.      a reader that checks a DLL for the custom attributes class
System.Attribute.IsDefined(t,typeof(Multichoice.Attributes.RuntimeConfig
))
4.      when the attribute is discovered it is collected and cast into a
waiting variable config =
(Multichoice.Attributes.RuntimeConfig)Attribute.GetCustomAttribute(t,typ
eof(
Multichoice.Attributes.RuntimeConfig));



in most cases step 3 returns false and step 4 fails even when the object
is
the type it is being cast to or the attribute does exist, this can be
confirmed by collecting the attributes from the type,  even if I collect
the
attributes from the type and find the correct attribute in the array the
cast fails, the objects can not be different as there is only on version
of
the attribute DLL  on the machine, in fact there is only one copy of the
attribute dll on the machine, but still it fails??, both the DLL using
the
attribute and the component interrogating for the attribute reference
the
same file build using the same file reside in the same folder, why does
.NET
insist that the following types are not the same



A.       Multichoice.Attributes.RuntimeConfig, Multichoice.Attributes,
Version=1.1.2004.17827, Culture=neutral, PublicKeyToken=aa94827d81467af7

B.       Multichoice.Attributes.RuntimeConfig, Multichoice.Attributes,
Version=1.1.2004.17827, Culture=neutral, PublicKeyToken=aa94827d81467af7







Paul Stevens
Analyst Developer
MultiChoice Africa
Cellular: * +27 (0) 82 413 3171
Phone: * +27 (0) 11 289 3576
Fax: * +27 (0) 82 131 413 3171
Mail: * [EMAIL PROTECTED]




************************************************************************
**************************************************
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(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


-------------------------------------
The information included in this message is personal and/or confidential
and
intended exclusively for the addressees as stated. This message and/or
the
accompanying documents may contain confidential information and should
be
handled accordingly. If you are not the intended reader of this message,
we
urgently request that you notify Centric immediately and that you delete
this e-mail and any copies of it from your system and destroy any
printouts
immediately.
It is forbidden to distribute, reproduce, use or disclose the
information in
this e-mail to third parties without obtaining prior permission from
Centric. We expressly point out that there are risks associated with the
use
of e-mail. Centric and the companies within the group shall not accept
any
liability whatsoever for damage resulting from the use of e-mail.
Legally
binding obligations can only arise for Centric by means of a written
instrument, signed by an authorized representative of Centric.
-------------------------------------

===================================
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

===================================
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

Reply via email to