Circulat dependency

  • Thread starter Thread starter Tal
  • Start date Start date
T

Tal

I am having assembly A with reference to assembly B and B need reference to
A. The IDE does not allow it because of circular dependency. How can I solve
it (when i cannot change existing code in A or B).
 
Tal said:
I am having assembly A with reference to assembly B and B need reference to
A. The IDE does not allow it because of circular dependency. How can I solve
it

Put them both in one assembly, or make a third assembly that contains
classes used by both, but using none of the other classes.
(when i cannot change existing code in A or B).

You can hardly solve problems without any change...

Niki
 
Tal said:
I am having assembly A with reference to assembly B and B need reference to
A. The IDE does not allow it because of circular dependency. How can I solve
it (when i cannot change existing code in A or B).

If A and B cross reference each other, you cannot compile them. So, it seems
very strange that you cannot change existing code in A or B because this
seems to indicate that someone gave you source code that does not compile
and prevented you from changing it! This does not make much sense.

You have to eliminate the cross references. And the only way to do it is to
change the code!

Bruno.
 
I agree that the situation seems absurd, but I like a challenge, and so I
think it is possible to fix without changing A or B.

All you need to do is add a new assembly that wraps (say) A using
reflection/late binding, and drop this dll into the reference point that B
is using.

I can't imagine why you would ever actually want to inflict this on
yourself, but it would work...

Nick.
 
Back
Top