android: FastDeploy.DeployFileWithFastDevTool failed with "Could not find file "/.../MyApp/obj/Debug/android/assets/Acr.UserDialogs.dll.mdb" error

Steps to Reproduce

  1. Create a Xamarin.Forms app
  2. Reference Acr.UserDialogs 7.0.35 package (the version is important, the latest version of the package works)
  3. Run the Android target on an Android device (or emulator)

Expected Behavior

The app is built and deployed to the device

Actual Behavior

The app is built but the deployment step fails with FastDeploy.DeployFileWithFastDevTool failure:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(586,5): error : Could not find file "/Users/my_user/Desktop/Sources/MyApp/Droid/obj/Debug/android/assets/Acr.UserDialogs.dll.mdb"
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(586,5): error :   at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00259] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:274 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(586,5): error :   at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:91 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(586,5): error :   at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(586,5): error :   at System.IO.File.OpenRead (System.String path) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/File.cs:266 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(586,5): error :   at Xamarin.Android.Tasks.FastDeploy.DeployFileWithFastDevTool (Microsoft.Build.Framework.ITaskItem file, System.String toolPath, System.String overridePath, System.Byte[] buffer, System.Byte[] compressed, K4os.Compression.LZ4.LZ4Level lz4level) [0x00061] in /Users/builder/azdo/_work/278/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:594 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(586,5): error :   at Xamarin.Android.Tasks.FastDeploy.DeployFastDevFiles (System.String toolPath, System.String overridePath) [0x0061c] in /Users/builder/azdo/_work/278/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:573 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(586,5): error :   at Xamarin.Android.Tasks.FastDeploy.RunTaskAsync () [0x00574] in /Users/builder/azdo/_work/278/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:223 
    4 Warning(s)
    1 Error(s)

Version Information

=== Visual Studio Enterprise 2019 for Mac (Preview) ===

Version 8.9 Preview (8.9 build 1593)
Installation UUID: 197b4b8d-2a9a-4fbd-896c-cd74849affd3
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

	Package version: 612000122

=== Mono Framework MDK ===

Runtime:
	Mono 6.12.0.122 (2020-02/c621c35ffa0) (64-bit)
	Package version: 612000122

=== Roslyn (Language Service) ===

3.9.0-4.21104.8+2fc92d84e746c3aab75f0930278ea6675cd5bb5c

=== NuGet ===

Version: 5.8.0.6860

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.103/Sdks
SDK Versions:
	5.0.103
	5.0.102
	5.0.101
	5.0.100
	5.0.100-rc.2.20479.15
	3.1.406
	3.1.405
	3.1.404
	3.1.403
	3.1.402
	3.1.401
	3.1.302
	3.1.301
	3.1.300
	3.1.201
	3.1.200
	3.1.102
	3.1.100
	3.1.100-preview3-014645
	3.1.100-preview2-014569
	3.0.100
	2.1.701
	2.1.700
	2.1.505
	2.1.504
	2.1.500
	2.1.402
	2.1.302
	2.1.301
	2.1.4
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	5.0.3
	5.0.2
	5.0.1
	5.0.0
	5.0.0-rc.2.20475.5
	3.1.12
	3.1.11
	3.1.10
	3.1.9
	3.1.8
	3.1.7
	3.1.6
	3.1.5
	3.1.4
	3.1.3
	3.1.2
	3.1.0
	3.1.0-preview3.19553.2
	3.1.0-preview2.19525.6
	3.0.0
	2.1.23
	2.1.22
	2.1.21
	2.1.20
	2.1.19
	2.1.18
	2.1.17
	2.1.16
	2.1.15
	2.1.14
	2.1.13
	2.1.12
	2.1.11
	2.1.9
	2.1.8
	2.1.6
	2.1.4
	2.1.2
	2.1.1
	2.0.5

=== .NET Core 3.1 SDK ===

SDK: 3.1.406

=== Xamarin.Profiler ===

Version: 1.6.12.31
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 12.4 (17801)
Build 12D4e

=== Xamarin.Mac ===

Version: 7.8.1.0 (Visual Studio Enterprise)
Hash: 17845a189
Branch: d16-9
Build date: 2021-01-26 03:42:37-0500

=== Xamarin.iOS ===

Version: 14.14.1.0 (Visual Studio Enterprise)
Hash: 17845a189
Branch: d16-9
Build date: 2021-01-26 03:42:38-0500

=== Xamarin Designer ===

Version: 16.9.0.309
Hash: 9a5259fb5
Branch: remotes/origin/9a5259fb55e54a445c145ab5ea29c04a418deed2
Build date: 2021-02-04 09:34:28 UTC

=== Xamarin.Android ===

Version: 11.2.0.0 (Visual Studio Enterprise)
Commit: xamarin-android/d16-9/f908d16
Android SDK: /Users/astrakh/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		5.0 (API level 21)
		5.1 (API level 22)
		6.0 (API level 23)
		7.1 (API level 25)
		8.0 (API level 26)
		8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.4
SDK Build Tools Version: 29.0.2

Build Information: 
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-9@1d382be
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.32.2@cfe06e0
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@ad80a42

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/astrakh/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.9.0.21
Hash: 57e40ba
Branch: remotes/origin/main
Build date: 2021-01-08 01:57:14 UTC

=== Android Device Manager ===

Version: 16.9.0.14
Hash: 0fdccda
Branch: remotes/origin/main
Build date: 2021-01-08 01:57:36 UTC

=== Build Information ===

Release ID: 809001593
Git revision: bf434e0df6f858da3d221515385acb8fe80b622a
Build date: 2021-02-11 10:01:48-05
Build branch: release-8.9
Xamarin extensions: bf434e0df6f858da3d221515385acb8fe80b622a

=== Operating System ===

Mac OS X 10.16.0
Darwin 20.2.0 Darwin Kernel Version 20.2.0
    Wed Dec  2 20:39:59 PST 2020
    root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

XAML Styler 2.0.1
Xamarin Hot Reload 20190830.17


Log File

deployment-new.log

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (8 by maintainers)

Most upvoted comments

So the workaround target does work

Removed Item(s): _ResolvedSymbols=obj\Debug\100\android\assets\Zambezi.dll.mdb

But the format of the command is missing files like Microsoft.IdentityModel.Clients.ActiveDirectory.dll.mdb because of the multiple periods. A new target which handles this scenario is below.

<Target Name="_RemoveMdbFiles" BeforeTargets="_Upload">
    <ItemGroup>
        <_Temp Include="%(_ResolvedSymbols.Identity)" Condition="'%(_ResolvedSymbols.Extension)' == '.mdb'" />
        <_ResolvedSymbols Remove="@(_Temp)"/>
    </ItemGroup>
</Target>

had the same problems - problems were solved with updating to Visual Studio version 16.9.2 - no need for workarounds/adaptions of csproj anymore.

So the workaround target does work

Removed Item(s): _ResolvedSymbols=obj\Debug\100\android\assets\Zambezi.dll.mdb

But the format of the command is missing files like Microsoft.IdentityModel.Clients.ActiveDirectory.dll.mdb because of the multiple periods. A new target which handles this scenario is below.

<Target Name="_RemoveMdbFiles" BeforeTargets="_Upload">
    <Message Text="%(_ResolvedSymbols.Extension)" />
    <ItemGroup>
        <_Temp Include="%(_ResolvedSymbols.Identity)" Condition="'%(_ResolvedSymbols.Extension)' == '.mdb'" />
        <_ResolvedSymbols Remove="@(_Temp)"/>
    </ItemGroup>
</Target>

This now worked for me. Thank you very much.

I already submitted a PR to Acr.UserDialogs to change PDB to portable and this is already merged. So use last nuget and be happy