Simon Simon - 1 year ago 146
C# Question

Xamarin Profiler fails to connect and run iOS app from VS2015

I'm trying to profile an iOS application to diagnose a memory leak. When I attempt to run the Xamarin Profiler from Visual Studio the application compiles and deploys to the device ok, but after the Profiler loads and I select which bits to monitor it pauses and then reports "Sorry, something went wrong trying to run ***". The log output is as follows:

INFO[2016-07-15 11:24:47Z]: ##########################################
INFO[2016-07-15 11:24:47Z]: # Xamarin Profiler version - 0.33.2.2
INFO[2016-07-15 11:24:47Z]: # * Arch x86_64
INFO[2016-07-15 11:24:47Z]: ##########################################
DEBUG[2016-07-15 11:24:47Z]: processing command line = C:\Program Files (x86)\Xamarin\Profiler\XamarinProfiler.exe --type=ios --target=*** --device=Device lab iPhone 6 Plus --options=host:10.1.5.85,port:51759,user:simonh,name:Device lab iPhone 6 Plus,mode:usb
DEBUG[2016-07-15 11:24:52Z]: instrument added
DEBUG[2016-07-15 11:24:52Z]: instrument added
DEBUG[2016-07-15 11:24:52Z]: instrument added
INFO[2016-07-15 11:24:52Z]: Creating ios run for *** target on device Device lab iPhone 6 Plus
DEBUG[2016-07-15 11:24:52Z]: Progress report initialized successfully
DEBUG[2016-07-15 11:24:52Z]: Connecting to 10.1.5.85 as simonh
DEBUG[2016-07-15 11:24:52Z]: Connecting to Xamarin Mac agent at 10.1.5.85
INFO[2016-07-15 11:24:53Z]: StartRecording for ***
DEBUG[2016-07-15 11:25:03Z]: Registering profiler12756simon as XMA client
DEBUG[2016-07-15 11:25:03Z]: Deploying profiler agent to 10.1.5.85
DEBUG[2016-07-15 11:25:15Z]: Starting listener on port 51759
DEBUG[2016-07-15 11:25:15Z]: Getting connection from Mac remote agent
DEBUG[2016-07-15 11:25:16Z]: Got response from agent: Run cae2ff15-faf5-406a-9ce7-*** (/*** on Device lab iPhone 6 Plus) started with heapshot=ondemand,alloc,nocalls,maxframes=8,sample=cycles/1000,
ERROR[2016-07-15 11:25:16Z]: error occured on run *** couldn't establish connection to device Device lab iPhone 6 Plus
ERROR[2016-07-15 11:25:16Z]: Error occured on run ***: couldn't establish connection to device Device lab iPhone 6 Plus
INFO[2016-07-15 11:25:16Z]: StopRecording for ***
DEBUG[2016-07-15 11:25:16Z]: Remote App stopped : cae2ff15-faf5-406a-9ce7-***
DEBUG[2016-07-15 11:25:16Z]: Remote App stopped : cae2ff15-faf5-406a-9ce7-***
DEBUG[2016-07-15 11:25:16Z]: Stopping profiler log reader
DEBUG[2016-07-15 11:25:16Z]: Stopping profiler log reader
ERROR[2016-07-15 11:25:16Z]: error occured on run *** Error on XMA listener: System.NullReferenceException: Object reference not set to an instance of an object.
at XamarinProfiler.Core.Platforms.ProfileIosXmaRun.AcceptClient()
DEBUG[2016-07-15 11:25:16Z]: Stopping profiler log reader


I'm running a fully updated Enterprise version of Visual Studio 2015 U3 and latest stable Xamarin tooling on Windows 8.1, and the latest stable tooling with Xamarin Studio on a MacBook Pro running OSX 10.11.5, as well as the latest Xamarin Profiler. My test device is an iPhone 6 Plus running iOS 9.3.2. The setup normally works well, full debugging etc, no issues.

Any help would be welcome!

Answer Source

This is a known issue right now. We do have a bug report for this, but it is internal so unfortunately I cannot share any details.

I would suggest right now to try Profiler directly on your Mac - or alternatively use Instruments:

https://developer.xamarin.com/guides/ios/deployment,_testing,_and_metrics/using_instruments_to_detect_native_leaks_using_markheap/

https://developer.xamarin.com/guides/ios/deployment,_testing,_and_metrics/walkthrough_Apples_instrument/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download