same type in 2 different assemblies - issues?

N

n_o_s_p_a__m

Ok, I have source code shared between 2 projects using links in VSS,
so we are compiling the same type information (classes, interfaces,
enums) into more than one assembly. This was done only by special
request of our client.

I am wondering if this is ok to do:

In AssemblyA: class1's methods returns myclass objects defined in
myclass.cs comiled into AssemblyX and referenced by project A.

(AssemblyA-->references-->AssemblyX-->contains-->myclass ; class1
methods-->returns-->myclass)

In AssemblyB: class2 declares objects of type myclass as return values
from calls to class1, except that in this case, class library B
references a different assembly (AssemblyY) which also has myclass.cs
compiled into it.

(AssemblyB-->references-->AssemblyY (and AssemblyA)-->AssemblyY also
contains-->myclass ; class2 calls class1-->returns-->myclass)


This seems to be causing some security issues.

Anyone know why and if this should/should not work?

-KJ
 
M

Mickey Williams

n_o_s_p_a__m said:
Ok, I have source code shared between 2 projects using links in VSS,
so we are compiling the same type information (classes, interfaces,
enums) into more than one assembly. This was done only by special
request of our client.

And if your client asked you to jump off a bridge, would you do that too?
Sorry, I started channeling my Mom for some reason ;)

From the runtime's point of view, the true name of a type includes the name
of the assembly that contains it. If you're using C#, and create two classes
that have the same source-level name identity (including the namespaces),
you're going to have issues. The runtime believes that type F.O.G in
assembly A is not the same type as F.O.G in assembly B. Unfortunately, (or
fortunately depending on your POV) there's no way to express that difference
in C#. The custom of my people is to factor the common types into a common
assembly.
 
E

Eric Newton

quote: "The custom of my people..."

LOL

It takes a village to raise a programmer ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top