473,414 Members | 1,729 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,414 software developers and data experts.

Circular references in .Net framework?

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.
Oct 21 '08 #1
2 1838
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
Oct 21 '08 #2

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
Oct 22 '08 #3

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

Similar topics

16
by: Kiuhnm | last post by:
Is there an elegant way to deal with semi-circular definitions? Semi-circular definition: A { B }; B { *A }; Circular reference: A { *B }; B { *A }; The problems arise when there are more...
2
by: Earth Worm Jim | last post by:
I have been able to get simple circular references to be serialized in xml by using the ImportTypeMapping method on the SoapReflectionImporter class. But I am unable to serialise circular...
0
by: ChipOne | last post by:
I have a Widget Class with a Parent and Child property of type Widget. When you populate a set of Widgets, you set references to the Parent and Child. I was using binary serialization, which...
12
by: Frank Rizzo | last post by:
I have a circular reference between 2 classes in the same project (i.e. each class refers to the other). The app runs fine and I am seeing no issues, which kind of surprised me. Are there any...
5
by: Gos | last post by:
Hi, It is known that .NET does not allow us to add circular references. Is there a way to workaround this problem by late-binding the objects at run time? Will this create any other problems? ...
6
by: Stephen Robertson | last post by:
We are currently in a dead end with a circular reference issue using vb.net, and are hoping someone might help us resolve it. Idea... We have frmmain calling frmperson (dim f as new frmperson)...
2
by: Lapu-Lapu | last post by:
I have authored a web service using ASP 2.0. The web services return objects that use generics and that also contain circular references. Programmatically, everything works well, as long as you...
5
by: Madhur | last post by:
Hello If I define two classes in the same cs file. And in each class, I define the object of other class as a member. Can anyone explain me how .NET or its compiler will resolve this kind of...
3
by: =?Utf-8?B?UGF1bCBIYWxl?= | last post by:
Moving all User Controls to a single directory has solved my problem - Thanks Eliyahu. That said, I still got one Circular ref error yesterday, rebuilt again and the build was fine? Far far...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.