Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2004

Tip: Looking for answers? Try searching our database.

Metadata importing puzzle

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gerhard Menzl - 04 Jun 2004 09:56 GMT
When using another assembly, I prefer adding it to the References
section of the project that uses it (thus adding the appropriate /FU
option to the compiler command line) over an explicit #using directive
in the source code. So far, this has worked without any problems.

Recently, however, I tried to reference an assembly for which this just
doesn't work. I have added it to References, the emitted command line
contains the /FU option with the correct path, and yet the compiler does
not recognize any of its types. Once I add a #using directive of
identical content to the source file to be compiled - normally a
redundant step -, the problem goes away.

Has anyone ever experienced anything like this and can provide an
explanantion or at least a clue? Does it make a difference whether the
assembly to be used was written in C# or C++?

Signature

Gerhard Menzl

Humans may reply by replacing the obviously faked part of my e-mail
address with "kapsch".

Arjun Bijanki [VCPP MSFT] - 04 Jun 2004 19:12 GMT
--------------------
> From: Gerhard Menzl <gerhard.menzl@spambucket.net>
> Newsgroups: microsoft.public.dotnet.languages.vc
[quoted text clipped - 16 lines]
> explanantion or at least a clue? Does it make a difference whether the
> assembly to be used was written in C# or C++?

Check the buildlog.htm and make sure the /FU was actually passed to the
compiler.  Also, sometimes the order of assembly import makes a difference
- #using is effectively reordering the references, which may make it work.

Signature

Arjun Bijanki, Microsoft Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Gerhard Menzl - 07 Jun 2004 08:19 GMT
> Check the buildlog.htm and make sure the /FU was actually passed to the
> compiler.  Also, sometimes the order of assembly import makes a difference
> - #using is effectively reordering the references, which may make it work.

I did check buildlog.htm; actually, that's what I was referring to when
I wrote "the emitted command line". Why should the order of references
be of any importance? Also I'm not aware of any way of influencing it.

Strangest of all, after several builds with the #using directive, I
removed it, and now everything works as expected. What is going on here?

Signature

Gerhard Menzl

Humans may reply by replacing the obviously faked part of my e-mail
address with "kapsch".

Arjun Bijanki [VCPP MSFT] - 07 Jun 2004 19:14 GMT
--------------------
> From: Gerhard Menzl <gerhard.menzl@spambucket.net>
> Newsgroups: microsoft.public.dotnet.languages.vc
> Subject: Re: Metadata importing puzzle
> Date: Mon, 07 Jun 2004 09:19:00 +0200

> > Check the buildlog.htm and make sure the /FU was actually passed to the
> > compiler.  Also, sometimes the order of assembly import makes a difference
[quoted text clipped - 6 lines]
> Strangest of all, after several builds with the #using directive, I
> removed it, and now everything works as expected. What is going on here?

Since the compiler does some type resolution when importing an assembly,
order of reference can sometimes affect the outcome.  This is rare, and
results in compiler errors ("xyz not defined").

If it started working after repeated builds, I can only suspect that types
were missing, and somehow the assemblies were updated to include those
types.  Is this possible?

Signature

Arjun Bijanki, Microsoft Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Gerhard Menzl - 08 Jun 2004 10:46 GMT
> If it started working after repeated builds, I can only suspect that
> types were missing, and somehow the assemblies were updated to include
> those types.  Is this possible?

I don't think so. But frankly, my schedule is way too tight to invest
much time in exploring this peculiarity. Thank you for your assistance.

Signature

Gerhard Menzl

Humans may reply by replacing the obviously faked part of my e-mail
address with "kapsch".


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.