473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Reference problem

I have a class Y in assembly B which is derived from a class Z in assembly
C. So I correctly add a reference to assembly C in assembly B, build
assembly B and everything builds fine. Now I create an assembly A which
refers to class Y in assembly B. So I add a reference in assembly A to
assembly B, and attempt to build. I get an error message, C3264, saying that
it could not find the type Z, and that it is in assembly C to which I have
no reference.

Is this a bug in VC++ 7.1 of VS .NET 2003 ? It is hard for me to believe
that referring to a type in an assembly means that I must also add a
reference not only to that type but to the assemblies which contain the base
class and/or interfaces of that type right up the hierarchy of all bases,
even when the assembly which has the type already has references to these
other assemblies. Is this really how .NET works ? Grrr !
Nov 17 '05 #1
4 1517
We are currently costing work to eliminate this issue in the cases where you
don't actually use any references to anything in assembly C. If you do
reference something directly you will still need to explicitly reference
assembly C. The reason for that is the fact that assembly location at
runtime is totally independent of assembly location at build time. And in
the case of a default VS install, they are different. Assembly B only
contains an assembly identity for assembly C, not the actual built time
location. And assembly binding is only useful for finding the runtime
version of assembly C.

Ronald Laeremans
Visual C++ team

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Kapil Khosla wrote:
Thanks for your feedback. I think it is a good suggestion but a hard
one to fix.
A solution could be that we pull in all types Y depends on in B.dll.
Say Z depends on A. Now A also comes in automatically for you when
you just referenced Y in B.dll.

There can be a lot of issues like these when we "automatically" pull
in the types. We have followed a header file scheme where you include
all the files you are referencing types in explicitly.
Plus, you just have to reference the assemblies explicitly the first
time, never again.

It can be worse if we include all the assemblies for you and then the
customer be surprised that he never referenced the type explicitly
but the type was pulled in anyway. Also imangine the size of our
assemblies if we pull in all the types which "might" be used. At
compile time, we dont know what types might be used.


You seem to have misunderstood. Assembly A only references class Y in
assembly B. Why does the linker then complain that I have not referenced
assembly C when building assembly A ? The reference in assembly A says
nothing about class Z in assembly C. If assembly B already has a reference
to assembly C, and I am referencing assembly B, why must I manually
reference assembly C also.

The analogous situation is standard Windows DLLs. If I have class Y in DLL
B
that references class Z in DLL C, I import class Z in DLL C into DLL B. If
I
then have DLL A that references class Y in DLL B, I import class Y in DLL
B
into DLL A. I do not need to import class Z in DLL C into DLL A.

Hope this helps
Thanks,
Kapil

In your example, say Z derived from A which is
"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:uJ**************@TK2MSFTNGP14.phx.gbl...
I have a class Y in assembly B which is derived from a class Z in
assembly C. So I correctly add a reference to assembly C in assembly
B, build assembly B and everything builds fine. Now I create an
assembly A which refers to class Y in assembly B. So I add a
reference in assembly A to assembly B, and attempt to build. I get
an error message, C3264, saying that it could not find the type Z,
and that it is in assembly C to which I have no reference.

Is this a bug in VC++ 7.1 of VS .NET 2003 ? It is hard for me to
believe that referring to a type in an assembly means that I must
also add a reference not only to that type but to the assemblies
which contain the base class and/or interfaces of that type right up
the hierarchy of all bases, even when the assembly which has the
type already has references to these other assemblies. Is this
really how .NET works ? Grrr !


Nov 17 '05 #2
Ronald Laeremans [MSFT] wrote:
We are currently costing work to eliminate this issue in the cases
where you don't actually use any references to anything in assembly
C.
I do not understand what you mean by "costing work".
If you do reference something directly you will still need to
explicitly reference assembly C.
Of course. But in my example I was not referencing anything in assembly C
but in assembly B, yet the IDE required me to create a reference for
assembly C.
The reason for that is the fact that
assembly location at runtime is totally independent of assembly
location at build time.
That is understood.
And in the case of a default VS install, they
are different. Assembly B only contains an assembly identity for
assembly C, not the actual built time location. And assembly binding
is only useful for finding the runtime version of assembly C.
Understood. But as I stated above, the issue was that I correctly added a
reference to assembly B from assembly A but was still required to add a
reference to assembly C from assembly A even though I was not referencing
anything in assembly C and assembly B, which was referencing something in
assembly C, already had a reference to assembly C. If I use assembly A I
would assume that since I am referencing assembly B, assembly B is loaded
into my application domain, and once assembly B is loaded, since assembly B
is referencing something from assembly C, that assembly is loaded into my
application domain. But there should be no need for assembly A to reference
assembly C in this scenario just to get assembly C loaded into my
application domain. That is the issue which I have brought up, and which I
hope you will fix.

Ronald Laeremans
Visual C++ team

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Kapil Khosla wrote:
Thanks for your feedback. I think it is a good suggestion but a hard
one to fix.
A solution could be that we pull in all types Y depends on in B.dll.
Say Z depends on A. Now A also comes in automatically for you when
you just referenced Y in B.dll.

There can be a lot of issues like these when we "automatically" pull
in the types. We have followed a header file scheme where you
include all the files you are referencing types in explicitly.
Plus, you just have to reference the assemblies explicitly the first
time, never again.

It can be worse if we include all the assemblies for you and then
the customer be surprised that he never referenced the type
explicitly but the type was pulled in anyway. Also imangine the
size of our assemblies if we pull in all the types which "might" be
used. At compile time, we dont know what types might be used.


You seem to have misunderstood. Assembly A only references class Y in
assembly B. Why does the linker then complain that I have not
referenced assembly C when building assembly A ? The reference in
assembly A says nothing about class Z in assembly C. If assembly B
already has a reference to assembly C, and I am referencing assembly
B, why must I manually reference assembly C also.

The analogous situation is standard Windows DLLs. If I have class Y
in DLL B
that references class Z in DLL C, I import class Z in DLL C into DLL
B. If I
then have DLL A that references class Y in DLL B, I import class Y
in DLL B
into DLL A. I do not need to import class Z in DLL C into DLL A.

Hope this helps
Thanks,
Kapil

In your example, say Z derived from A which is
"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:uJ**************@TK2MSFTNGP14.phx.gbl...
I have a class Y in assembly B which is derived from a class Z in
assembly C. So I correctly add a reference to assembly C in
assembly B, build assembly B and everything builds fine. Now I
create an assembly A which refers to class Y in assembly B. So I
add a reference in assembly A to assembly B, and attempt to build.
I get an error message, C3264, saying that it could not find the
type Z, and that it is in assembly C to which I have no reference.

Is this a bug in VC++ 7.1 of VS .NET 2003 ? It is hard for me to
believe that referring to a type in an assembly means that I must
also add a reference not only to that type but to the assemblies
which contain the base class and/or interfaces of that type right
up the hierarchy of all bases, even when the assembly which has the
type already has references to these other assemblies. Is this
really how .NET works ? Grrr !

Nov 17 '05 #3
Costing == estimating the dev and test cost of changing the design here.
Step 2 in getting it shipped. Step 1 is determining whether we think we
should do it in the first place if we can, and that is already done, the
answer there is yes, if we can fit it in, we will.

Ronald

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:eB**************@TK2MSFTNGP14.phx.gbl...
Ronald Laeremans [MSFT] wrote:
We are currently costing work to eliminate this issue in the cases
where you don't actually use any references to anything in assembly
C.


I do not understand what you mean by "costing work".
If you do reference something directly you will still need to
explicitly reference assembly C.


Of course. But in my example I was not referencing anything in assembly C
but in assembly B, yet the IDE required me to create a reference for
assembly C.
The reason for that is the fact that
assembly location at runtime is totally independent of assembly
location at build time.


That is understood.
And in the case of a default VS install, they
are different. Assembly B only contains an assembly identity for
assembly C, not the actual built time location. And assembly binding
is only useful for finding the runtime version of assembly C.


Understood. But as I stated above, the issue was that I correctly added a
reference to assembly B from assembly A but was still required to add a
reference to assembly C from assembly A even though I was not referencing
anything in assembly C and assembly B, which was referencing something in
assembly C, already had a reference to assembly C. If I use assembly A I
would assume that since I am referencing assembly B, assembly B is loaded
into my application domain, and once assembly B is loaded, since assembly
B
is referencing something from assembly C, that assembly is loaded into my
application domain. But there should be no need for assembly A to
reference
assembly C in this scenario just to get assembly C loaded into my
application domain. That is the issue which I have brought up, and which I
hope you will fix.

Ronald Laeremans
Visual C++ team

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Kapil Khosla wrote:
Thanks for your feedback. I think it is a good suggestion but a hard
one to fix.
A solution could be that we pull in all types Y depends on in B.dll.
Say Z depends on A. Now A also comes in automatically for you when
you just referenced Y in B.dll.

There can be a lot of issues like these when we "automatically" pull
in the types. We have followed a header file scheme where you
include all the files you are referencing types in explicitly.
Plus, you just have to reference the assemblies explicitly the first
time, never again.

It can be worse if we include all the assemblies for you and then
the customer be surprised that he never referenced the type
explicitly but the type was pulled in anyway. Also imangine the
size of our assemblies if we pull in all the types which "might" be
used. At compile time, we dont know what types might be used.

You seem to have misunderstood. Assembly A only references class Y in
assembly B. Why does the linker then complain that I have not
referenced assembly C when building assembly A ? The reference in
assembly A says nothing about class Z in assembly C. If assembly B
already has a reference to assembly C, and I am referencing assembly
B, why must I manually reference assembly C also.

The analogous situation is standard Windows DLLs. If I have class Y
in DLL B
that references class Z in DLL C, I import class Z in DLL C into DLL
B. If I
then have DLL A that references class Y in DLL B, I import class Y
in DLL B
into DLL A. I do not need to import class Z in DLL C into DLL A.
Hope this helps
Thanks,
Kapil

In your example, say Z derived from A which is
"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:uJ**************@TK2MSFTNGP14.phx.gbl...
> I have a class Y in assembly B which is derived from a class Z in
> assembly C. So I correctly add a reference to assembly C in
> assembly B, build assembly B and everything builds fine. Now I
> create an assembly A which refers to class Y in assembly B. So I
> add a reference in assembly A to assembly B, and attempt to build.
> I get an error message, C3264, saying that it could not find the
> type Z, and that it is in assembly C to which I have no reference.
>
> Is this a bug in VC++ 7.1 of VS .NET 2003 ? It is hard for me to
> believe that referring to a type in an assembly means that I must
> also add a reference not only to that type but to the assemblies
> which contain the base class and/or interfaces of that type right
> up the hierarchy of all bases, even when the assembly which has the
> type already has references to these other assemblies. Is this
> really how .NET works ? Grrr !


Nov 17 '05 #4
Ronald Laeremans [MSFT] wrote:
Costing == estimating the dev and test cost of changing the design
here. Step 2 in getting it shipped. Step 1 is determining whether we
think we should do it in the first place if we can, and that is
already done, the answer there is yes, if we can fit it in, we will.
I hope you can. Logically a programmer should only have to worry about
referencing an assembly where references are actually made, but I am sure
you know that. Happy fitting <g> !

Ronald

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:eB**************@TK2MSFTNGP14.phx.gbl...
Ronald Laeremans [MSFT] wrote:
We are currently costing work to eliminate this issue in the cases
where you don't actually use any references to anything in assembly
C.


I do not understand what you mean by "costing work".
If you do reference something directly you will still need to
explicitly reference assembly C.


Of course. But in my example I was not referencing anything in
assembly C but in assembly B, yet the IDE required me to create a
reference for assembly C.
The reason for that is the fact that
assembly location at runtime is totally independent of assembly
location at build time.


That is understood.
And in the case of a default VS install, they
are different. Assembly B only contains an assembly identity for
assembly C, not the actual built time location. And assembly binding
is only useful for finding the runtime version of assembly C.


Understood. But as I stated above, the issue was that I correctly
added a reference to assembly B from assembly A but was still
required to add a reference to assembly C from assembly A even
though I was not referencing anything in assembly C and assembly B,
which was referencing something in assembly C, already had a
reference to assembly C. If I use assembly A I would assume that
since I am referencing assembly B, assembly B is loaded into my
application domain, and once assembly B is loaded, since assembly B
is referencing something from assembly C, that assembly is loaded
into my application domain. But there should be no need for assembly
A to reference
assembly C in this scenario just to get assembly C loaded into my
application domain. That is the issue which I have brought up, and
which I hope you will fix.

Ronald Laeremans
Visual C++ team

"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Kapil Khosla wrote:
> Thanks for your feedback. I think it is a good suggestion but a
> hard one to fix.
> A solution could be that we pull in all types Y depends on in
> B.dll. Say Z depends on A. Now A also comes in automatically for
> you when you just referenced Y in B.dll.
>
> There can be a lot of issues like these when we "automatically"
> pull in the types. We have followed a header file scheme where you
> include all the files you are referencing types in explicitly.
> Plus, you just have to reference the assemblies explicitly the
> first time, never again.
>
> It can be worse if we include all the assemblies for you and then
> the customer be surprised that he never referenced the type
> explicitly but the type was pulled in anyway. Also imangine the
> size of our assemblies if we pull in all the types which "might"
> be used. At compile time, we dont know what types might be used.

You seem to have misunderstood. Assembly A only references class Y
in assembly B. Why does the linker then complain that I have not
referenced assembly C when building assembly A ? The reference in
assembly A says nothing about class Z in assembly C. If assembly B
already has a reference to assembly C, and I am referencing
assembly B, why must I manually reference assembly C also.

The analogous situation is standard Windows DLLs. If I have class Y
in DLL B
that references class Z in DLL C, I import class Z in DLL C into
DLL B. If I
then have DLL A that references class Y in DLL B, I import class Y
in DLL B
into DLL A. I do not need to import class Z in DLL C into DLL A.

>
> Hope this helps
> Thanks,
> Kapil
>
> In your example, say Z derived from A which is
> "Edward Diener" <ed******@tropicsoft.com> wrote in message
> news:uJ**************@TK2MSFTNGP14.phx.gbl...
>> I have a class Y in assembly B which is derived from a class Z in
>> assembly C. So I correctly add a reference to assembly C in
>> assembly B, build assembly B and everything builds fine. Now I
>> create an assembly A which refers to class Y in assembly B. So I
>> add a reference in assembly A to assembly B, and attempt to
>> build. I get an error message, C3264, saying that it could not
>> find the type Z, and that it is in assembly C to which I have no
>> reference.
>>
>> Is this a bug in VC++ 7.1 of VS .NET 2003 ? It is hard for me to
>> believe that referring to a type in an assembly means that I must
>> also add a reference not only to that type but to the assemblies
>> which contain the base class and/or interfaces of that type right
>> up the hierarchy of all bases, even when the assembly which has
>> the type already has references to these other assemblies. Is
>> this really how .NET works ? Grrr !

Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pkpatel | last post by:
Hi, I keep getting this error every time I try to load crystalreportviewer on a webform with a dataset. Here is the error: -------------------------------------------------------- Server...
6
by: trexim | last post by:
Hi, I am trying to create a Web Reference for CSTA using the URL http://www.ecma-international.org/standards/ecma-348/csta-wsdl/csta-wsdl-all-operations.wsdl Visual .Net complains that: "...
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
2
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is...
3
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here...
5
by: Michael Russell | last post by:
Hi all, Using C#, I've created a simple wrapper class for using Excel. I have Office Pro 2003 installed on my devel machine. The wrapper class works great, reading and writing to/from Excel. ...
27
by: David W | last post by:
I'm almost tearing my hair out. A colleague claimed that a null reference can exist, like this: void f( int& p ) { printf( "%d\n", p ); } int main (int argc, char *argv) {
8
by: toton | last post by:
HI, One more small doubt from today's mail. I have certain function which returns a pointer (sometimes a const pointer from a const member function). And certain member function needs reference...
2
by: toton | last post by:
Hi, This is continuation of topic pointer & reference doubt. http://groups.google.com/group/comp.lang.c++/browse_thread/thread/df84ce6b9af561f9/76304d7d77f6ccca?lnk=raot#76304d7d77f6ccca But I...
29
by: shuisheng | last post by:
Dear All, The problem of choosing pointer or reference is always confusing me. Would you please give me some suggestion on it. I appreciate your kind help. For example, I'd like to convert a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.