You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[One .NET] fix duplicate .pdb files for multiple RIDs
Deploying a project that uses two `$(RuntimeIdentifiers)` will fail on
our new fast deploy system with:
Xamarin.Android.Common.Debugging.targets(589,5): Access to the path 'obj/Debug/net5.0-android/android/assets/' is denied.
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at Xamarin.Android.Tasks.FastDeploy.DeployFileWithFastDevTool(ITaskItem file, String toolPath, String overridePath, Byte[] buffer, Byte[] compressed, LZ4Level lz4level) in /Users/builder/azdo/_work/18/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 579
at Xamarin.Android.Tasks.FastDeploy.DeployFastDevFiles(String toolPath, String overridePath) in /Users/builder/azdo/_work/18/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 491
at Xamarin.Android.Tasks.FastDeploy.RunTaskAsync() in /Users/builder/azdo/_work/18/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 175
Reviewing the log, there are some weird things happening. Some
incorrect `@(_ResolvedSymbols)` items are passed to the
`<FastDeploy/>` MSBuild task:
_ResolvedSymbols
obj/Debug/net5.0-android/android/assets/
obj/Debug/net5.0-android/android/assets/
This is caused by the contents of the `@(ResolvedFileToPublish)` item
group:
ResolvedFileToPublish
obj/Debug/net5.0-android/HelloForms.dll
obj/Debug/net5.0-android/android.21-arm64/HelloForms.pdb
obj/Debug/net5.0-android/android.21-x86/HelloForms.pdb
Since `HelloForms.dll` doesn't map to a single `HelloForms.pdb`, the
`%(DestinationSubPath)` item metadata is not added by the
`<ProcessAssemblies/>` MSBuild task.
And so the following item transform generates an incorrect result:
<_ResolvedSymbols Include="@(ResolvedSymbols->'$(MonoAndroidIntermediateAssemblyDir)%(DestinationSubPath)')" />
To fix this:
* `@(_ResolvedSymbols)` should check if `%(DestinationSubPath)` is blank.
* Call `->Distinct()` on input to the `<ProcessAssemblies/>` MSBuild task.
* Patch up the `@(_DebugSymbolsIntermediatePath)` item group, so that
it uses the proper value for `@(IntermediateOutputPath)` of the
outer build.
See: https://github.com/dotnet/msbuild/blob/65d31a0151b072b910d9ea16e152265d467e3239/src/Tasks/Microsoft.Common.CurrentVersion.targets#L374
After these changes, the `@(ResolvedFileToPublish)` item group appears
correct now:
ResolvedFileToPublish
obj/Debug/net5.0-android/HelloForms.dll
obj/Debug/net5.0-android/HelloForms.pdb
`HelloForms.pdb` now makes it to the `.apk` file as well.
Other changes:
* Updated a test to look for `UnnamedProject.pdb` during a multiple
RID build.
* I removed the `Removing duplicate: ...` log message, as it was
printing hundreds of log messages that aren't particularly useful.
Copy file name to clipboardExpand all lines: src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.AssemblyResolution.targets
0 commit comments