✅ Circular References
Being unable to do circular references seems like an unnecessary roadblock in some cases, at least for private projects.
See the following example. (Image)
Common represent a general helper project, while Pool project represent, for the purposes of this example, memory management helpers.
Pool benift from the Common helpers, but Common also uses some memory management helpers internally.
They are separate projects for code cleanliness reasons and also for the fact that they contain quite different functionality in general and could be used independently.
Obviously I am aware that leaving one of their resulting dlls out if this was allowed would cause some features in the remaining dll to break, that isn't the point.
Way 1 of fixing this "properly" is to add a Common Common project for the common project where the very very common code goes... Sure. At that point the natural progression of things is way 2.
Way 2 of fixing this "properly" would be to merge the two dlls or internally implement whatever are needed from each other which is generally what I have done.
But both is extremely ugly, I have them separated for a reason.
And some projects implement types that are exposed publicly so would require exposing duplicate of such types which is a mess in it self.
Another way is to reference the resulting dlls of a project instead of an actual project reference, which is pretty hacky and breaks ide features.
It's also pretty interesting that if editing the .csproj file manually visual studio basically fails to load the projects properly silently in terms of code analysis but then msbuild breaks with a nuget error code?
Rider is mostly the same.
Don't tell me the only reason this is hard blocked is because nuget doesn't allow it? I have exactly zero interest in uploading anything to nuget anyway, why does nugets dependency rules effect the entire language?
You can tell me it's bad coding in general to do circular references all you want, It certainly would be if the projects were intended to be published independently / publicly but they are not. It's just for basic organization and is not for public release.
Am I willing to make pointless abstractions to half of my code for no reason? No.
40 Replies
I don't think it matters if it's a private/personal project or not, it's a chicken and egg scenario
it doesn't make logical sense.
You cannot compile one, without the other
It's not much of a common project, if it then relies on another project.
Break common's dependency on pool 🙂
Roslyn doesn’t require a reference to be a compiled dll file though. A compilation reference can be another compilation. It can be done if the devs of msbuild were willing to do it.
It isn’t a clr violation either.
So no I don’t see it as a chicken or egg scenario since neither project needs to be fully compiled to reference eachother.
then go to another language, lol
Well that isn’t helpful 😦
neither is being stubborn in the face of how to do this properly in .NET
It’s a compiler limitation not a .net limitation
Guess what the compiler is a part of
Is msbuild a part of the clr? No.
It's a part of the generic umbrella term ".NET"
So, yes, the compiler "limitation" is a .NET limitation
there's more to .NET than the CLR
.NET is an ecosystem
getting hung up on semantics also doesn't really matter. You can't do what you want because it doesn't make sense in this world.
The result would have been the same if all the code where in the same compilation, the limitation of not allowing me to organize within the means of the project structure is arbitrary.
I think we've arrived back at, https://discord.com/channels/143867839282020352/1209238802854584340/1209247116904505344
Patrick
then go to another language, lol
Quoted by
<@104975006542372864> from #Circular References (click here)
React with ❌ to remove this embed.
which is ironic, considering the context of the question.
It does make sense, and it would work just fine in Roslyn’s perspective
We're firmly in the "I should be able to eat soup with a fork!" territory
why not open a discussion on the roslyn repository 🙂
How?
This is an msbuild problem not Roslyn
"You can't eat soup with a fork, it will leak"
"But I should be able to!"
"You can't, it makes no sense"
"But it does!"
I'm beginning to think you opened this just to be pedanitc
Roslyn supports what I want
this isn't how it's intended to work
is that enough?
I opened a post to hear if there were a reasonable solution that didn’t involve A. Merging all my general purpose library and B. Doesn’t involve causing unessesary abstraction.
All I got was to be told to find a different programming language and that same person and another that keeps spamming the same logical falciy reference that are irallivant due to what I explained above.
No, you were told it's not logical in .NET
you proceeded to ignore the only right answer, so were told to find a language where it's ok to do that
And I respectfully disagree in part due to the fact Roslyn supports it natively on its own
you've come here looking for a specific answer, cannot get said answer, and are upset that your way of thinking doesn't align with the .NET team
ergo, .NET is not for you
it doesn't matter if you disagree
I don't know what part of this is up for debate
Just because you have
goto
doesn't mean you should use it.But I don’t even have go to though I got go F off 🤷♂️
Dude... You got the answer in a very respectful manner
you believe its possible, u dont want to take the word of experienced people and u believe the problem is msbuild, then file an issue there and see how it goes...
https://github.com/dotnet/msbuild
Being told to F off in the most respectable way perhaps
Jesting about going to another language when you're clearly experienced enough to understand CLR and other components that make up your .NET experience doesn't equate to telling you to fuck off
I know it can be done natively with Roslyn since I am actively doing so.
It seems you poeple have declared it not to be so though, so I do indeed doubt it will help me much
im not declaring anything, I am pointing you to the direction to make it happen or be told its not going to happen
discussing here wont change that, you either file it as a issue and see what happens
or argue here for no reason
You may not be but the two others sure are
well its up to you if u sit here discussing what is possible or not vs getting it in the right place and either getting a "no this is not something planned" or a "we will consider this"
Well fair enough then.
Hoesntly I would have forked Roslyn for years ago if it wasn’t for the fact I would lose all ide comparability
I see.
Fork the ide too then
Pretty sure both visual studio and rider is closed source. Visual studio doesn’t even support filtering out auto fill suggestions. And to be fair I do got actual work to do at some point…
Well anyway guys thanks for confirming me know that there is no supported work around at least