-
Couldn't load subscription status.
- Fork 1.2k
Apply conflict resolution to RuntimeTargets items #1121
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
Apply conflict resolution to RuntimeTargets items #1121
Conversation
|
|
||
| <ItemGroup> | ||
| <!-- We need to find all the files that will be loaded from deps for conflict resolution. | ||
| To do this, we look at the files that would be copied local when CopyLocalLockFileAssemblies is true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update this comment?
|
It's curious to me that building with RuntimeIdentifier=<rid> and CopyLocalLockFileAssemblies=true wouldn't include the RID-specific assets. That feels like a bug. |
| <_LockFileAssemblies Include="@(AllCopyLocalItems->WithMetadataValue('Type', 'assembly'))" /> | ||
|
|
||
| <!--RuntimeTarget--> | ||
| <_RuntimeTargetItems Include="@(_ActiveTFMFileDependencies->WithMetadataValue('FileGroup', 'RuntimeTarget'))" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the uniqueness of these item names, but do a scrub to make sure there are no conflicts with anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scrub within the context of the SDK or are you saying I should look elsewhere too? If so, where?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just sdk is fine. I think we should probably have some naming convention for private items to help avoid conflicts but it doesn't make sense to start establishing that in this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok if it fixes the problem, but you may want to understand why the copy-local items were missing RID specific assets when building with a RID. That sounds like it could impact other frameworks that use Build rather than publish to produce a flat runnable output (eg: desktop, UAP).
By default, CopyLocalLockFileAssemblies is only true when targeting something besides .NET Core or .NET Standard. The other frameworks (primarily .NET Framework) don't support loading architecture-specific assets at runtime like this. So it looks like it usually won't matter that they aren't copied locally. On the other hand it seems like it wouldn't hurt to copy them and might make CopyLocalLockFileAssemblies work better as a "mini-publish" or something for .NET Core. Perhaps @eerhardt can provide some feedback or insight. |
| <!-- We need to find all the files that will be loaded from deps for conflict resolution. | ||
| To do this, we look at the files that would be copied local when CopyLocalLockFileAssemblies is true | ||
| --> | ||
| <_LockFileAssemblies Include="@(AllCopyLocalItems->WithMetadataValue('Type', 'assembly'))" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existing issue, but we also need to do conflict resolution of native assets. Is that covered by this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it is. NuGet.ProjectModel is returning "assembly" for the Type property for this entry in the assets file:
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {
"type": "package",
"runtimeTargets": {
"runtimes/debian.8-x64/native/System.Security.Cryptography.Native.OpenSsl.so": {
"assetType": "native",
"rid": "debian.8-x64"
}
}
},So when we get to this line, it is included in what we pass to the conflict resolution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting, I guess the deps file is still correct since that gets copied from assets but this is something @eerhardt might hit if we tried to reconstruct the deps file from these items.
| } | ||
| } | ||
|
|
||
| public static string ConflictResolutionTestMethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a pretty specific thing to be on the general TestAsset. The above method went from something that was more general "netstandard1.3. stuff", to "ConflictResolution"-specific.
Is there a better place for this conflict resolution stuff than on the general TestAsset?
Native assets + This is why we have the following logic: https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.RuntimeIdentifierInference.targets#L18-L100 and https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.RuntimeIdentifierInference.targets#L138-L151 which infers a On .NET Core, we have the /cc @nguerrera who did this inference logic in SDK 1.0 for .NET Framework. |
| <_RuntimeTargetItems Include="@(_ActiveTFMFileDependencies->WithMetadataValue('FileGroup', 'RuntimeTarget'))" /> | ||
| <__RuntimeTargetPublishItems Include="@(FileDefinitions)" Exclude="@(_RuntimeTargetItems)" /> | ||
| <_RuntimeTargetPublishItems Include="@(FileDefinitions)" Exclude="@(__RuntimeTargetPublishItems)" /> | ||
| <!--<RuntimeTargetPublishItems Include="%(_RuntimeTargetPublishItems.ResolvedPath)" />--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this comment? It seems unnecessary.
Yeah understood. I thought the issue here was native issues with RID-set, I used <rid> in the comment but GitHub omitted that because i didn't escape the brackets. Simple misunderstanding. Carry on. |
Just an FYI for everyone, |
|
Yep, understood. |
|
@ManishJayaswal for approval. |
|
@dsplaisted @livarcocc ask mode template? |
|
@ManishJayaswal Here you go: Customer scenario Target .NET Core 2.0 or .NET Standard 2.0 and use NuGet packages that target 1.x versions of .NET Core or .NET Standard Bugs this fixes: n/a Workarounds, if any n/a Risk Low - this includes an additional type of item in conflict resolution, which had been included before I switched how these items were collected. Performance impact Low - processing some additional items which were already processed in a previous version of the code. Is this a regression from a previous update? It's a regression introduced in #1052, to functionality that hasn't shipped yet. Root cause analysis: #1052 switched to a cleaner way to get the runtime items for conflict resolution (using items already flowing through MSBuild instead of running a "fake" publish task), but the new logic didn't include items of type RuntimeTarget. How was the bug found? Failures when inserting updated SDK into .NET CLI repo: dotnet/cli#6304 |
…121.10 (dotnet#1121) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19571.10
RuntimeTargets items were not being included in conflict resolution, leading to failures when trying to use APIs from packages such as System.Diagnostics.TraceSource. This PR now includes these items in the in the
OtherRuntimeItemsparameter passed toResolvePackageFileConflictstask.I'm also including an update to .gitignore to exclude .binlog files, which is MSBuild's new binary logging format.
cc @ericstj @eerhardt