Azure-Samples / active-directory-b2c-xamarin-native

This is a simple Xamarin Forms app showcasing how to use MSAL to authenticate users via Azure Active Directory B2C, and access a Web API with the resulting tokens.
http://aka.ms/aadb2c
MIT License
109 stars 65 forks source link

Running solution gives error that 'Xamarin.Forms.Platform.Android.dll.mdb' file could not be found #151

Open blaineross opened 3 years ago

blaineross commented 3 years ago

I have cloned the repo and I'm now trying to run the solution using the .Droid project within visual studio (2019, v 16.9. The setup says you will need 2017 but I could not even open the android project in 2017 successfully).

On running up the emulator I get an error -

Severity Code Description Project File Line Suppression State Error Could not find file 'C:\...\active-directory-b2c-xamarin-native\UserDetailsClient\UserDetailsClient.Droid\obj\Debug\100\android\assets\Xamarin.Forms.Platform.Android.dll.mdb'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at Xamarin.Android.Tasks.FastDeploy.<DeployFileWithFastDevTool>d__99.MoveNext() in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 569 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Xamarin.Android.Tasks.FastDeploy.<DeployFastDevFiles>d__98.MoveNext() in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 548 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Xamarin.Android.Tasks.FastDeploy.<RunTaskAsync>d__86.MoveNext() in /Users/builder/azdo/_work/30/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 216 0

I have tried running the solution with the emulator set as follows Nexus 9 API 28 (Pie 9.0 - API 28) Pixel 2 API 28 (Pie 9.0 - API 28)

I am relatively new to mobile development, but I have used both emulator setups on other visual studio projects without issues and both are within the requirements suggested on the MASL wiki.

Am I missing something obvious here?

jmprieur commented 3 years ago

@trwalke : would you have an idea?

trwalke commented 3 years ago

This is due to issues with the underlying Xamarin/VS components. I would recommend:

1) Update VS 2019 to the latest 2) Delete bin and obj files for projects 3) restart PC if the above does not work

jmprieur commented 3 years ago

Thanks @trwalke @blaineross did this solve your issue?

trwalke commented 3 years ago

One last thing @blaineross, Make sure you place the sample in a relatively short directory path like C:/B2C_Sample or something similar. sometimes the build will fail because some of the files being referenced may have a file path length that exceeds the windows character limit. (256)