-
Notifications
You must be signed in to change notification settings - Fork 1.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
Changed behavior of DependencyContext.Default.RuntimeLibraries? #34288
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @dotnet/area-dependencymodel Issue DetailsAfter recent updated of SDK/Runtime our ASP.NET Core 6 app (runtime 6.0.14 and SDK 7.0.201) break because DependencyContext.Default.RuntimeLibraries started to return duplicated entries. After investigation we find out that duplicated entry has different type of 'Reference assembly'. Fix was simple but I'm wonder is this intended behavior or maybe bug?
|
@dominikjeske do you have a repro or can share the deps.json content before and after? Thanks |
What was the "simple fix" you applied. We've suddenly got the same problem popping up on 2 out of 10 dev machines. |
A quick mitigation is to downgrade the .NET SDK version to 6. |
We just added simple Where in our code - it works in our scenario
|
This issue has been marked |
This issue has been automatically marked |
Will be nice to understand, is this a bug/side effect or feature. |
We need a repro of this. I don't see a deps.json attached to this bug and the description above is not sufficient to repro. Output on
Similar on 6.0 (count was 11) and 8.0 (same count). Can someone with a repro project share their project or modify the repro I shared above to reproduce the issue? Otherwise we might need to resolve as no-repro. |
This issue has been marked |
@ericstj I have tested your solution and was very confused because everything was ok. I have done some investigation and finally found how it can be reproduced. In our solutions we are using AssemblyName attribute in projects. You can set this in your lib.csproj
and in main program execute this
it should return one element on actual SDK. When you introduce global.json and set SDK used to build you will see that on SDK below 7.0.2* (for example 7.0.109) you will get zero elements and every SDK after will give you additional reference assembly. |
I don't have a repro at the moment, but I have the example of change I had to make in code that uses Scrutor:
With Throw strategy it throws on duplicate, using the first version of FromThisSolution:
|
Thank you @dominikjeske that did it. This is adding an additional entry to the deps.json as follows: "test/1.0.0": {
"runtime": {
"test.dll": {}
}
},
"test.Reference/1.0.0.0": {
"runtime": {
"test.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
} Two different libraries are listed in the deps file as well: "test/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"test.Reference/1.0.0.0": {
"type": "reference",
"serviceable": false,
"sha512": ""
} This seems to be a creation of the SDK's GenerateDepsFile task. Nowhere else does this appear - not in the project.assets.json or the build log. Seems like this was regressed with #28963. That change did include a flag to skip the new behavior: IncludeProjectsNotInAssetsFileInDepsFile. I was able to set this and the problem goes away.
Still it seems a bug that the SDK treats this as a runtime assembly at all. Something got confused with this mapping. I suspect somewhere there is a bad assumption about project-name == assembly name or similar. Transferring this to SDK. I updated the sample repo so that it reproduces the behavior: |
@ericstj Thanks a lot for investigation. For me it also looks like a bug. |
After recent updated of SDK/Runtime our ASP.NET Core 6 app (runtime 6.0.14 and SDK 7.0.201) break because DependencyContext.Default.RuntimeLibraries started to return duplicated entries. After investigation we find out that duplicated entry has different type of 'Reference assembly'. Fix was simple but I'm wonder is this intended behavior or maybe bug?
The text was updated successfully, but these errors were encountered: