-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inconsistent/diverging build outcome from API and dotnet build, msbuild, VS #49874
Comments
@ltcmelo: how did you end up with the Microsoft.CodeAnalysis.Projects that were set up in that way? The Roslyn Project/Compiler APIs are lower-level APIs that won't try to second-guess the inputs given to them: if there is bad data going in, then that should be addressed there. So the compilation error is "by design" in that sense. That said, if you got those projects from MSBuildWorkspace then this would absolutely be a bug since it should be executing the dedup logic that lives in MSBuild. So were these projects you created yourself or got from another API? |
@jasonmalinowski the project setup didn't come from
Agreed; this could be checked by Buildalyzer (I've actually patched in my code), and the bogus I understand that MSBuild is a thing in its own, but the current inability to mirror Roslyn-based builds with those from MSBuild/VS (even though I mentioned Buildalyzer, you can reproduce this specific "manually", filling a |
Is the code available to look at that's doing the population? My worry is if the ProjectReferences are being populated directly from the in the project file, that isn't going to be correct unless you take a lot of care. (And this is a commonly written bug, see OmniSharp/omnisharp-roslyn#1956 for me fixing that in VS Code...) |
Our code isn't open source, but thanks for the pointer @jasonmalinowski ; it's good to know about that. In any case, the check that I currently do is solely based on the |
I guess once we're handed a list of references, we don't know where they came from either due to how it's abstracted and all we could do is an AssemblyName filter. Basically, we can't work around bugs from higher layers without causing other regressions, so closing. |
Version Used: 3.8.0
Steps to Reproduce:
Consider proj.sln with libX.csproj and libY.csproj, and with libY.csproj referencing libX as follows — in
a supposedly bogus .csproj, given that libX is referenced both as a project and as a binary/assembly.
Despite the duplicity of references to libX from libY.csproj, building the solution proj.sln is successful in all of:
However, if I have 2
Microsoft.CodeAnalysis.Project
objects that mirror the setup I described above — with correspondingProjectReference
andMetadataReferences
in "projLibY" for "projLibX" — and attempt to build them, I get a compilation error such as:While I'd acknowledge that the csproj file in question isn't really correct, for the sake of consistency with the other building mechanisms (which silently handle the duplication), I'd consider this behavior of the API a bug.
NOTE: In order to reproduce the issue, one might need to ensure that libX.dll is a different binary from that produced by the current build of libX.csproj.
The text was updated successfully, but these errors were encountered: