PC Review


Reply
Thread Tools Rate Thread

Circular references in .Net framework?

 
 
Dansk
Guest
Posts: n/a
 
      21st Oct 2008
Hi all,

I am currently writing some code that explores assemblies dependencies.

I start loading the first assembly with Assmebly.LoadFrom which gives me
an Assembly instance.

Then, I enumerate the AssemblyNames from the GetReferencedAssemblies()
collection.

And foreach AssemblyName in that collection, I call again Assembly.Load.

.... and so on recursively...

The first run made a call stack overflow.

After debugging a bit, I discovered that Assembly System.dll has a
dependency on System.Xml.dll, which has itself a dependency on System.dll.

The first and the second system.dll are at the same location (the GAC)

System.Xml.dll is also in the GAC.

Where am I wrong?


Thanks in advance,
Dansk.
 
Reply With Quote
 
 
 
 
Marc Gravell
Guest
Posts: n/a
 
      21st Oct 2008
That sounds about right...

There are a few circular references in the base libraries... not a
good idea for regular code, but arguably necessary in some scenarios.
You can't create a circular reference via the IDE - you have to use
the command line libraries and a lot of trouble.

The trick is (when walking references) to keep a track of things you
have visited, and stop when you see them again.

Marc
 
Reply With Quote
 
Dansk
Guest
Posts: n/a
 
      22nd Oct 2008

Well... ok.
Thank you for the info, then, even if I find it a bit odd...

Don't worry, I won't even have the idea to try having circular
references in my projects!

Thanks again.
Dansk

Marc Gravell wrote:
> That sounds about right...
>
> There are a few circular references in the base libraries... not a
> good idea for regular code, but arguably necessary in some scenarios.
> You can't create a circular reference via the IDE - you have to use
> the command line libraries and a lot of trouble.
>
> The trick is (when walking references) to keep a track of things you
> have visited, and stop when you see them again.
>
> Marc

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using circular references bismuth83 Microsoft Access Queries 2 7th May 2008 06:16 PM
Circular References in the .NET Framework Stephan Brenner Microsoft Dot NET Framework 0 2nd May 2007 11:41 PM
Re: Circular references Ken Wright Microsoft Excel Misc 0 5th Sep 2003 10:30 PM
Re: Circular references win Microsoft Excel Misc 0 5th Sep 2003 10:02 PM
Re: Circular references Ken Macksey Microsoft Excel Misc 0 5th Sep 2003 07:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:57 PM.