Bug 17611 - Can not deploy/run/debug project on simulator from visual studio
Summary: Can not deploy/run/debug project on simulator from visual studio
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 1.10.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Dominique Louis
URL:
Depends on:
Blocks:
 
Reported: 2014-02-05 09:45 UTC by softlion
Modified: 2015-01-20 18:14 UTC (History)
17 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:
RESOLVED FIXED

Description softlion 2014-02-05 09:45:48 UTC
From Visual Studio (2012 or 2013), on 2 machines, i am unable to run/debug any app.

Repro:
load any ios7 sample into VS
run it (CTRL+F5)

vs log:

Starting debug on:iPhone (Retina) 7.0
Mono.IOS.VisualStudio.MonoTouchPackage Error: 0 : Exception caught.
System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
   at System.Net.HttpWebRequest.GetResponse()
   at MonoTouch.Tools.Utilities.BuildServerClient.ServerIO.Server_GetResult[T](String command, IDictionary`2 queryVariables)
Mono.IOS.VisualStudio.MonoTouchPackage Error: 0 : Xamarin.iOS encountered the following error(s):
System.Exception: Failed to change active application on server (Generic)
Server command 'ChangeActiveApplication': failed to change active application on server

Command execution task ended with exception

Exception System.Net.WebException: The remote server returned an error: (500) Internal Server Error.

Exception details can be found in the log file

Running ComCatenumIntouchIosMono.IOS.VisualStudio.MonoTouchPackage Error: 0 : Exception caught.
System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
   at System.Net.HttpWebRequest.GetResponse()
   at MonoTouch.Tools.Utilities.BuildServerClient.ServerIO.Server_GetResult[T](String command, IDictionary`2 queryVariables)
Mono.IOS.VisualStudio.MonoTouchPackage Error: 0 : Xamarin.iOS encountered the following error(s):
System.Exception: Failed to run application (Generic)
Server command 'DebugApplication': failed to start application debugging session

Command execution task ended with exception

Exception System.Net.WebException: The remote server returned an error: (500) Internal Server Error.

Exception details can be found in the log file





mtbserver.log

[05-févr.-2014 06:39:24] Command [StartDebugProxy: CommmandUrl=StartDebugProxy] finished (13)
[05-févr.-2014 06:39:24] Got connection from Visual Studio (log)
[05-févr.-2014 06:39:24] Handling with command: [DebugApplication: CommmandUrl=DebugApplication] (16)
[05-févr.-2014 06:39:24] Attempting to acquire command execution lock, timeout set to 00:10:00
[05-févr.-2014 06:39:24] Error: Command [DebugApplication: CommmandUrl=DebugApplication] failed.
[05-févr.-2014 06:39:24] Exception: Exception type: System.NullReferenceException
Object reference not set to an instance of an object
  at Mtb.Server.Commands.DebugApplication.StartLogProxy (MonoTouch.Tools.Tools.Mtouch mtouch) [0x00000] in <filename unknown>:0 
  at Mtb.Server.Commands.DebugApplication.StartProxy (MonoTouch.Tools.Tools.Mtouch mtouch) [0x00000] in <filename unknown>:0 
  at Mtb.Server.Commands.DebugApplication.HandleRequest (ILoggingHelper logger, System.Object commandRequestState) [0x00000] in <filename unknown>:0 
  at Mtb.Server.BaseCommand.OnRequest (System.Net.HttpListenerContext context, System.Object commandRequestState) [0x00000] in <filename unknown>:0 
  at Mtb.Server.Listener.OnRequest (System.Object state) [0x00000] in <filename unknown>:0 
[05-févr.-2014 06:39:32] ExitCode: 0
Comment 1 Andrei.N 2014-02-05 11:43:39 UTC
I have the exact error and stack call as well.
Comment 2 Atin 2014-02-11 11:19:27 UTC
We have checked this issue with:

Windows 8
XS for VS 1.12.212
MT 7.0.7
VS 2013/12

We are not able to reproduce this issue, application is successfully deployed on device as well as on simulator using VS 2013/12.
Comment 3 PJ 2014-02-11 18:35:08 UTC
This issue is fixed in the 7.0.7 hotfix build Atin, you wouldn't see it there.

Unfortunately, I don't think we were ever reliably able to reproduce the issue. That means we will be unable to properly verify the fix.

Marking back as RESOLVED FIXED. 

Benjamin, Andrei - please try the Xamarin.iOS 7.0.7 hotfix when it is released, it contains the fix.
Comment 4 softlion 2014-02-12 00:02:25 UTC
I would love it. Atin could you send the link for it ?
Comment 9 softlion 2014-02-14 01:04:06 UTC
Hotfix fixed it ! thks.

On mac: beta channel
On pc: alpha channel
Comment 13 softlion 2014-02-21 19:23:18 UTC
In fact it fixed all issues. If a customer still has an issue, tell him to open and compile the project using Xamarin Studio MAC.

He will have compilation errors. Once fixed it will deploy nicely again using Visual Studio.

These errors are often located in resource files (missing or at wrong places) and are not reported by Visual studio remote build. But are reported by Xamarin Studio Mac.
Comment 14 softlion 2014-02-21 19:25:35 UTC
One thing to note: you MUST close Xamarin Build Host AND Visual Studio after each compilation failure, as it leaves both in an inconsistent state and nothing will build at all. 

Re-Open Xamarin Build Host FIRST, then VS2013. Otherwise it also won't compile at all without any message.
Comment 15 Emmanuel Huna 2014-02-22 17:27:12 UTC
This is still happening for me on 7.0.7

Windows: VS 2013, on beta channel, 7.0.7
Mac: Xamarin Studio, on beta channel, 7.0.7

Using Xamarin Studio on the Mac, app compiles and deploys to the simulator without problems.

Using VS 2013 on Windows, same error when deploying:

  Server command 'Build': application remote build failed
  Command execution task ended with exception
  Exception System.Net.WebException: The remote server returned an error: (500) Internal Server Error.

Come on folks, everyone in this thread is telling you there's an issue, don't just mark it as "RESOLVED FIXED" until you understand what the problem is.

Just because you are unable to reproduce it easily, it doesn't mean that the bug does not exist.  Developers are wasting many hours on this.
Comment 16 Emmanuel Huna 2014-02-22 17:32:49 UTC
Here's what I see in ~/Library/Logs/Xamarin/MonoTouchVS/mtbserver.log

[22-Feb-2014 11:58:31] Server initialized
[22-Feb-2014 11:58:31] Waiting for requests
[22-Feb-2014 11:58:46] Apple SDK developer root: /Applications/Xcode.app/Contents/Developer
[22-Feb-2014 11:58:47] Server IP Address : 209.1.2.3
[22-Feb-2014 11:58:48] Error: An error occurred (no details available)
[22-Feb-2014 11:58:48] Got connection from Visual Studio (log)
[22-Feb-2014 11:58:48] Error: Error accepting log connection from Visual Studio
[22-Feb-2014 11:58:48] Exception: Exception type: System.ObjectDisposedException
The object was used after being disposed.
  at System.Net.Sockets.Socket.EndAccept (System.Byte[]& buffer, System.Int32& bytesTransferred, IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.Socket.EndAccept (IAsyncResult result) [0x00000] in <filename unknown>:0 
  at Mtb.Server.Proxy.LogProxy.VS_IncomingOutput (IAsyncResult result) [0x00000] in <filename unknown>:0 

(209.1.2.3 is not the Mac real IP, just an example)
Comment 17 PJ 2014-02-25 16:06:49 UTC
Hi Emmanuel,

It does look like you're experiencing a separate issue from the one originally reported, although the behavior you're experiencing looks the same.  I sent you a build that should address the issue privately by email, and I've filed your bug as bug 18002. 

I'm going to set this one back to RESOLVED FIXED, although I know that some additional bugs might be displaying a similar behavior - I understand the frustration.

If anyone else sees similar behaviors despite using the iOS 7.0.7.2 and iOS for VS 1.10.39 build that are currently in stable, please file a new bug (and feel free to link to this one). We're very happy to take additional reports, but we're also confident that the original issue here is fixed.
Comment 18 PJ 2014-02-28 11:57:49 UTC
A note to anyone who is seeing a similar issue - there are two other bugs that result in the "The remote server returned an error (500)" message. 

The first is bug 18002, and is fixed in an unreleased version of Xamarin.iOS. If you are experiencing the exception listed, please comment on the bug.

The second bug is bug 18060, and has a workaround listed. 

If you are experiencing a similar issue that does not fall into this bug or the two bugs above, please file a new bug. 

Sorry for the frustrating generic error message, we'll continue to eradicate such experiences.
Comment 19 Cody Beyer (MSFT) 2015-01-14 23:34:26 UTC
Attempting to build against three build configurations causes failure with a Mac Build Host

[08-Jan-2015 14:59:06] Attempting to acquire command execution lock, timeout set to 00:10:00
[08-Jan-2015 14:59:06] Command [ExecuteTask: CommmandUrl=ExecuteTask] finished (10)
[08-Jan-2015 14:59:06] Request handled in 11.006ms
[08-Jan-2015 14:59:06] Handling with command: [ExecuteTask: CommmandUrl=ExecuteTask] (10)
[08-Jan-2015 14:59:06] Attempting to acquire command execution lock, timeout set to 00:10:00
[08-Jan-2015 14:59:06] Command [ExecuteTask: CommmandUrl=ExecuteTask] finished (10)
[08-Jan-2015 14:59:06] Request handled in 7.199ms
[08-Jan-2015 14:59:09] Server IP Address : 0.0.0.0
[08-Jan-2015 14:59:34] Got connection from Visual Studio (log)
[08-Jan-2015 14:59:34] Error: Error accepting log connection from Visual Studio
[08-Jan-2015 14:59:34] Exception: Exception type: System.ObjectDisposedException
The object was used after being disposed.
at System.Net.Sockets.Socket.EndAccept (System.Byte[]& buffer, System.Int32& bytesTransferred, IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.Sockets.Socket.EndAccept (IAsyncResult result) [0x00000] in <filename unknown>:0
at Mtb.Server.Proxy.LogProxy.VS_IncomingOutput (IAsyncResult result) [0x00000] in <filename unknown>:0
[08-Jan-2015 14:59:34] Error: An error occurred (no details available)
Comment 21 softlion 2015-01-16 06:47:43 UTC
Works for me. If you have fiddler on the same machine as Visual Studio, add a bypass rule with the IP of your build host.
Comment 22 Brendan Zagaeski (Xamarin Team, assistant) 2015-01-20 18:14:20 UTC
Thanks for the reply @softlion :)

I think reopening this bug was incorrect. Upon review, I think comment 19 and comment 20 are discussing a different problem. The bug was accidentally reopened because the error messages on this bug report are fairly generic, and so easy to hit via a bugzilla keyword search.

For any users who might come across this bug in the future, PJ's statements and recommendations from earlier in the report are still accurate:

> we're ... confident that the original issue here is fixed.
(comment 17)

and

> If you are experiencing a similar issue that does not fall into this bug or the
> two bugs above, please file a new bug.
(comment 18)


In short, if you think you're seeing something like this, please file a new bug. If it really turns out to be a duplicate of this bug (unlikely), then the Xamarin developers can mark it as a duplicate, and this bug can be reopened.

Thanks!