My understanding is that the type is defined with reference to the namespace
from which it is exposed and the namespace does not neccessarily correspond
to the assembly name ie namespaces can span assemblies so one could
conceivably define the same type in two different assemblies.

I do support your sentiments re building and version controlling PIAs -
something that appears to be somewhat undocumented.

regards

-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of J. Merrill
Sent: 10 January 2004 01:35
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Best way to share an interface definition
amoung components tier


At 01:05 PM 1/9/2004, Eric Gunnerson wrote (in part)
>My two cents...
>[snip]
>It's also nice
>because it makes sure the interface doesn't show up in multiple
>assemblies, which can cause some hard-to-troubleshoot bugs.

That's because the IWhatever interface defined in assembly A is a different
interface than the IWhatever interface defined in assembly B, even if
everything about the definition of those interfaces matches 100% (exact same
parent interface [if any], exact same member names in the exact same order,
every member routine and event having the exact same parameters and [not for
events] result).  An interface is a type, and the full name of a type
includes the assembly in which it's defined.

A similar issue exists with COM wrappers -- if no one builds a "primary
interop assembly" (PIA) for a particular COM component, you can end up with
multiple interop assemblies that have the same definition (based on a
particular COM component) but they are NOT the same type, because they're
defined in different assemblies.  If you -- for example -- write a class
that inherits from one of those interop assemblies, and the client machine
has only the other interop assembly on his machine, your assembly won't
load.

Every COM component that doesn't have a PIA is an accident waiting to
happen.  Ditto with any interface defined -- even identically -- in more
than one place.

J. Merrill / Analytical Software Corp

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

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