Bug 52315 - Can't deploy iOS app
Summary: Can't deploy iOS app
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 4.3.0 (C9)
Hardware: PC Windows
: High major
Target Milestone: 4.3.0 (C9)
Assignee: Emanuel
URL:
Depends on:
Blocks:
 
Reported: 2017-02-05 22:20 UTC by kontakt
Modified: 2017-04-29 20:56 UTC (History)
10 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description kontakt 2017-02-05 22:20:32 UTC
I have current beta (Xamarin.iOS 10.4.0.97) (VS 2015, Xamarin 4.3.0.621) and I can't deploy my app.

Deploying on simulator worked for about a day and suddenly stopped working, deploying to device never worked with this version.

Build is successful, but when deploying, I immeadiatelly get this error:
"An unexpected error occurred while checking consistency between the local app and the remote build for YouWakeMe.iOS. Please rebuild the application and try again. Check the logs for more details"

Nothing more anywhere in Xamarin logs.

Clean and rebuild doesn't help. Deleting obj and bin folder doesn't help.
Comment 1 kontakt 2017-02-05 23:57:39 UTC
OK, I know where is the problem and found a workaround.

I used procmon to track the issue and this is the result:

These two files:

1) MyAppFolder\MyApp.iOS\obj\iPhoneSimulator\Debug\build-signature\signature

2) ~Library\Caches\Xamarin\mtbs\builds\MyApp.iOS\..some code..\obj\iPhone Simulator\Debug\build-signature\signature

were actually named 'signatura' and should be 'signature'. Renaming both files to 'signature' solved the issue and deploying now works.

I guess that 'signatura' is just 'signature' translated to Czech, the language of my Windows.

Also what might be related, every time I debug the app, this is my very beggining of Debug Output:

InspectorDebugSession(0): StateChange: Start -> EntryPointBreakpointRegistered
InspectorDebugSession(0): Constructed
Exception dropped on floor: System.AggregateException: One or more errors occurred. ---> System.Security.Cryptography.CryptographicException: Klíč není platný pro použití v zadaném stavu.

   at System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData, Byte[] optionalEntropy, DataProtectionScope scope)
   at Xamarin.VisualStudio.Inspector.SshCommands.EnsureSshConnection() in C:\data\lanes\4033\7bbc66a8\source\xamarinvs\src\Features\VisualStudio.Inspector\Vsix\SshCommands.cs:line 94
   at Xamarin.VisualStudio.Inspector.SshCommands.<GetHomeDirectoryAsync>d__10.MoveNext() in C:\data\lanes\4033\7bbc66a8\source\xamarinvs\src\Features\VisualStudio.Inspector\Vsix\SshCommands.cs:line 42
--- 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 Xamarin.VisualStudio.Inspector.VSAgentExecutionTarget.<CheckMacHostForInteractiveInstallAsync>d__7.MoveNext() in C:\data\lanes\4033\7bbc66a8\source\xamarinvs\src\Features\VisualStudio.Inspector\Vsix\VSAgentExecutionTarget.cs:line 88
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.Security.Cryptography.CryptographicException: Klíč není platný pro použití v zadaném stavu.

   at System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData, Byte[] optionalEntropy, DataProtectionScope scope)
   at Xamarin.VisualStudio.Inspector.SshCommands.EnsureSshConnection() in C:\data\lanes\4033\7bbc66a8\source\xamarinvs\src\Features\VisualStudio.Inspector\Vsix\SshCommands.cs:line 94
   at Xamarin.VisualStudio.Inspector.SshCommands.<GetHomeDirectoryAsync>d__10.MoveNext() in C:\data\lanes\4033\7bbc66a8\source\xamarinvs\src\Features\VisualStudio.Inspector\Vsix\SshCommands.cs:line 42
--- 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 Xamarin.VisualStudio.Inspector.VSAgentExecutionTarget.<CheckMacHostForInteractiveInstallAsync>d__7.MoveNext() in C:\data\lanes\4033\7bbc66a8\source\xamarinvs\src\Features\VisualStudio.Inspector\Vsix\VSAgentExecutionTarget.cs:line 88<---

Launching 'MyApp.iOS' on 'iPhone SE iOS 10.2'...


"Klíč není platný pro použití v zadaném stavu." is again in Czech language and it means something like "The key is not valid for usage in given state."
Comment 2 xamarin-release-manager 2017-02-06 18:52:30 UTC
Fixed in version 4.3.0.643 (cycle9)

Author: Emanuel
Commit: e71b5c904fcacb4304a66b906caa2ade553ceb1e (xamarin/XamarinVS)
Comment 3 Saurabh 2017-02-07 13:08:57 UTC
I can reproduce this Issue with mentioned build (XVS 4.3.0.621).

I am still getting the Issue with latest Cycle 9 build XVS 4.3.0.643

Build error:
Severity	Code	Description	Project	File	Line	Suppression State
Error		An unexpected error occurred while checking consistency between the local app and the remote build for App45. Please rebuild the application and try again. Check the logs for more details

Environment Info: https://gist.github.com/AkhileshKumar01/2cc92d7965ca68b022563f89d873a80c
Comment 7 Emanuel 2017-02-09 17:45:15 UTC
Hi @kontakt@rihadavid.cz, 
We couldn't reproduce this issue using Xamarin for Visual Studio 4.3.0.621, but after doing an investigation we found a potential cause and we fixed it. This potential fix will be available in the next Beta refresh. 

After updating to the new version you'll need to Rebuild your app to force the re-generation of the signature file.

I'll mark this bug as Resolved Fixed, but feel free to reopen it if you still face this issue after updating. 

Please let us know if you cannot reproduce this issue anymore after updating, so we can mark it as verified.

Thanks!
Comment 8 Luis Aguilera 2017-02-17 15:01:51 UTC
Hello kontakt@rihadavid.cz
to add a little more detail... this fix was included in XVS 4.3.0.738 which was published to the Alpha and Beta channels on Feb 14. 

As we are unable to reproduce this issue, we cannot effectively verify the fix ourselves. So it would be very helpful if you can check this recent XVS build to determine whether the issue is in fact resolved successfully.

Thanks!
Comment 9 kontakt 2017-02-17 17:01:40 UTC
Yes, it seems to be fixed in XVS 4.3.0.738.
Comment 10 Danish Akhtar 2017-02-21 05:00:14 UTC
As per Comment 9, user is not facing this issue anymore. Hence closing this issue.
Comment 11 kinex 2017-04-29 20:56:29 UTC
This issue still happens at least once in an hour during a development session. My workaround is to restart Visual Studio and connect to Mac agent again. I am using Visual Studio 2015 15.1 (26403.7), Xamarin 4.4.0.34, Xamarin.iOS 10.8.0.174.

Generally current Visual Studio 2015 + remoted iOS simulator combination is so buggy and unstable that it is practically unusable. I spend 1-2 hours every day trying to start the remoted iOS Simulator (it just won't start sometimes even though Mac connection is ok, hangs to "Connecting", "Connected" or "Updating" and nothing happens). After I finally manage to start the iOS simulator successfully (usually requires rebooting Mac or PC, disconnecting/reconnecting Mac agent, trying different simulators etc.), I can develop maybe max 30 min - 60 min until I get this error "An unexpected error occurred while checking consistency between the local app and the remote build for xxxx". Then I need to restart Visual Studio and start playing with the iOS simulator to get it up and running again. All this happens in loop many times a day. And this is not all, also the whole Visual Studio hangs totally several times a day so that you have to kill it using Task Manager (which usually means again playing with the iOS simulator startup challenge). This happens often when you are debugging the app using the iOS simulator.