I cannot hit a breakpoint in VS when debugging any native iOS app through VS2017 Pro. I have trawled the Xamarin/Stack forums and seen this has been a problem in the past and I have tried the suggestions but they relate to a 3.xxx version of Xamarin. Even an out-the-box new project untouched except for placing a breakpoint still does not hit, the build server pops up the simulator and runs as expected. Android is fine
This was working, I have recently downgraded from Enterprise to Pro but think this may be a red herring. I have 2015/13 pro installed with the same problem.
Is this an issue build server side or the windows side? I get the following generated in my bin App.app, App.exe, App.pdb but no app.mdb i do get the referenced dll.mdb files.
Current vs setup...
Microsoft Visual Studio Professional 2017 (2)
Version 15.1 (26403.7) Release
VisualStudio.15.Release/15.1.0+26403.7
Microsoft .NET Framework
Version 4.6.01586
Installed Version: Professional
...
Visual Studio Tools for Universal Windows Apps 15.0.26403.07
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.
Xamarin 4.4.0.34 (3f99c5a)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android SDK 7.2.0.7 (b16fb82)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 10.8.0.174 (7656cc6)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
The Mac
Xamarin Studio 6.3
VS for Mac 7
See this similar answer: Xamarin iOS debugger not hitting breakpoints
Also, make sure you don't have a firewall blocking Port 10000.
I ran into something similar, and it turns out my debug settings for my physical device had some defaults that prevented debugging from working. This may not fix your issue, but you might want to at least check your project settings for a few things.
Under iOS Build I changed my Linker Behavior from Link All to Link Framework SDKs Only. Also, for some reason in a default debug profile, the Strip native debugging symbols option on that same page was checked. Make sure it's unchecked.
This one was already enabled for me but you should verify anyway: double check that on the page iOS Debug that Enable Debugging is checked.
I faced a similar issue but on Android application: I solved by uncheck the option "Code Optimization" from Project >> Options >> Build and set the DebugType to Full
Same here, windows 10, VS 2017 -> MAC -> iPhone
Somtimes I got Debug-Log and can hit breakpoints but mostly not.
A solution / workaround which at least works for me.
Problem:
Setup: Windows 10 with VS2017, Mac-Book, iPhone connected to Mac-Book.
Debug-Log / Breakpoint-Hitting seams to work sometimes (seldom) / non deterministic.
Solution / workaround:
Verify: In case no Debug-Log occurs (e.g. no "Loaded assembly:..." lines etc.) the "Choose Device" drop-down box in the "Tools >> iOS >> Device Log" window shows TWO times the name of the iOS-device.
Stop the debug and explicitly stop the app on the iOS-device (if necessary also delete it for re-deploy)
Via "Tools >> iOS >> Xamarin Agent" disconnect from your Mac and then reconnect again.
Verify: the "Choose Device" drop-down in the "Tools >> iOS >> Device Log" window now shows only ONE times the name of the iOS-device.
Debug the App - it now should work.
See also XamarinForum
Hope it also works for you.
Erdega
Related
This is for Xamarin 8.10.11 (Build 8) for MacOS, Community Edition.
I recently returned to Xamarin development and opened a mobile project that I had worked on about a month ago. However both the Xamarin.iOS and Xamarin.Android projects have a yellow warning triangle beside them saying that the appropriate tool chain is not installed.
Both are installed.
If I download the latest DMG and request to install, it says there's nothing to be done (and indicates that both iOS and Android components are already installed).
Any thoughts on what else I can try?
The Show Details in the About dialog is missing all the relevant components (a colleague sent me their listing from a correctly working installation).
So, eventually I figured it out.
The problem is that mobile development in Visual Studio is added as an extension. And for no reason I can fathom, all the Mobile Development extensions had been disabled.
I have no idea how that happened, but re-enabling them made the problem go away.
I'm trying to setup new MacBook as a build server remotely for xamarin projects. It is in my office and I connect there with rdp from Windows 10 from home.
On MacBook: installed Xcode, Apple Developer Tools, Transporter. On windows: connected to mac, entered AppleID in visual Studio, enabled Automatic Provisioning.
Then I build my Xamarin.Forms ios project in "AppStore" configuration and it's ok.
Then I click "Archive" on that project and get error message from Visual Studio Archive Manager:
Selected device doesn't support archiving.
The selected ios device is not supported for creating an archive.
Please select a remote device from the drop-down menu before archiving.
Do I have to have iPhone to build my app? Where - in MacBook location or at home?
Archiving of a new default project works in Xcode (the active scheme is set to "Any iOS device (arm64)"). The error is in visual studio.
Visual Studio 2019 - (16.11.2)
XCode 12.5.1
There is a new version that fixes this
It seems that remote device option does not show in drop menu in VS 16.11 .
Check the similar cases : here and here .
Try to downgrade Visual studio to 16.10.x to see if problem persists.
You can download the older version from this link .
You don't need a physical device to archive. Just click the bar on the top-left of your screen, then select the Any iOS Device option. On older versions of Xcode, I think it was called Generic iOS Device. After this, hit Product -> Archive again.
It looks like Microsoft have finally released a fix for this in 16.11.3: The release notes are here:
https://learn.microsoft.com/en-us/visualstudio/releases/2019/release-notes#16.11.3
The solution in 2022 is to choose "Remote Device" from the "Debug" dropdown:
This is hinted at in the question, but that error message no longer explains what to do (!?!)
In short: I am unable to run my app in the iPhone Simulator. There is no "Play button" (the triangle), only a Debugger button (hammer):
As you can see above I have "Generic Simulator". When I click on it, there is no list of various iPhones/iPads to choose from:
If I choose Android, I am able to run the app:
I have XCode installed. I ran XCode once.
I also installed the Command Line tools.
I created a new Xamarin Forms App:
Here are my iOS build options:
I am able to run the Simulator separately:
Creating an App in XCode and running in the Simulator works:
info.plist:
Prefrences -> SDK Locations -> Apple
Build -> Configurations:
Here is the kicker though. If I run a Xamarin App on my Windows machine using the iPhone Simulator on the Mac, it works!
What do I need to do so I can run my app inside the Simulator vis Visual Studio for Mac?
Few options you can worth to check. #WorldOfBasti suggested options plus following.
Configuration
Right click on the solution -> options -> Configurations -> Configuration manager -> ProjectName.iOS with Debug|iPhoneSimulator should be checked or if configuration "ProjectName.iOS with Debug|iPhoneSimulator" is not available then add this from General tab
Apple SDK path
Check Apple SDK path is set properly (Preference -> SDK Location -> Apple). It should have green tick mark with Xcode version and SDK path location.
Minimum system version (Deployment Target)
Change Deployment Target to minimum version (ie, lower than your simulator version)
Switch debug <-> release
Today I have also faced same issue which you are facing. I have switched debug to release, iOS to Android. Then reverted back to iOS and debug from the top device selection status bar. Then Simulator option was appearing. So, might be UI updated issue in Visual studio for mac. Please give a try.
I assume that you tried the basics things like restarting your Mac, etc. So here are a few things, that might solve your problem:
Check your build configurations, here is a good video
Close VS for Mac, start Xcode and create a test project which you run on a simulator. If it works try again in VS for Mac
Close VS for Mac, goto Xcode -> Preferences -> Accounts and download the manual profiles of your developer account. Try again in VS for Mac
Clean your project: In VS for Mac, goto Build -> Clean All. Then Close VS for Mac, goto your project folder and delete in "yourprojectname" and "yourprojectname".iOS all bin and obj folders. Try again
If all of this doesn't work, I would try to reinstall it (if you have any important projects, make a backup):
Uninstall VS for Mac and Xcode
Install Xcode again from the App Store
Install Visual Studio for Mac
Hopefully it works..
Looking at the Visual Studio for Mac logs, specifically the IDE log, I found this line ... 'The target name of simulated device could not be added because it's already cached'.
You are welcome to read through all of this ... but you may just want to go down to the Addendum 2 (final?) and see if that works for you ... it ends up being simpler and quicker than anything else I have found.
So, at first, I started clearing the cache with a 'xcrun simctl erase all' command from Terminal, and when I started Visual Studio for Mac I could run a Xamarin App, but launching the simulator took quite a bit of time.
So hare's something I found works that you might want to try ...
Close iOS Simulator on Mac (if any).
Close ALL copies of Visual Studio that are connected to the Mac ... either on the Mac itself or on another computer connected to the Mac (if any).
Start Visual Studio for Mac.
If you can't run a Xamarin App, Close Visual Studio for Mac.
Launch the Simulator manually (I have it in the Dock, so I just click it) ... wait for it to fully startup.
Now close the Simulator (from the Simulator menu).
Now restart Visual Studio for Mac.
If you still can't see the simulator devices to run on ... try the above steps one more time (this time you should only have to close Visual Studio for Mac followed by manually starting the Simulator, waiting for it to start, and then quitting the Simulator and finally restarting Visual Studio for Mac).
It still isn't great, but this has (so far) always worked for me. And the Simulator starts up substantially quicker then if I did a 'xcrun simctl erase all' command from Terminal.
Addendum: Most of the time the above works. But occasionally I still have to clear the cache from the Terminal with 'xcrun simctl erase all' command.
Also: I have also found (although maybe it's just my imagination) that clearing out the Visual Studio for Mac temporary .binlog files that are written in the 'T' folder will sometimes fix the problem (if you look at an IDE log from Visual Studio for Mac; right after the 'The target name of simulated device could not be added because it's already cached' message, you should see some .tmp files being created. The directory where they were created is the 'T' folder I'm talking about). I sometimes delete the tmp*.binlog and tmp*.tmp as a last ditch effort before using the 'xcrun simctl erase all' command to try to get back to where Visual Studio for Mac will see the iOS Simulator Devices.
Finally: This is really starting to feel like a bug in Visual Studio for Mac startup (or possibly during a iOS project load). The reason I say that is I can ALWAYS see the iOS Device list from Visual Studio for Windows (as long as I can connect to the Mac). In addition, I can leave Visual Studio for Mac running (even hidden) and test an app on the iOS Simulator from Windows, then, leaving the iOS Simulator Running on the Mac, run an App on Visual Studio for Mac. If there really were a 'caching issue' with the Simulator it seems to me I should have problems running anything on the Mac after using the iOS Simulator from Windows, but it always works. For now, I'm working on a single Xamarin Project on the Mac (and I don't use the Mac for anything else), So I just let Visual Studio for Mac 'open at login' (Dock setting) and automatically 'load previous solution on startup' (Visual Studio for Mac setting), hide Visual Studio for Mac (Dock Setting) and if I need it, Visual Studio for Mac is already loaded and able to see iOS Devices to run Apps on with a quick click on the Dock Icon.
Addendum 2 (final?): I have now found that if I just close a solution that I have open that shows 'Generic Simulator' and re-open it without exiting Visual Studio for Mac (sometimes I have to do it multiple times ... I think I've counted up to 5 times before it finally worked), it will start showing the device list and I can run the iOS app in the Simulator. I don't even have to close the Simulator if it's already running, which saves a bunch of time.
It still feels like a bug to me, I don't see why I would have to close/open a solution multiple times to get the iOS devices listed and be able to run an iOS app. What really gets me is if I reboot the Mac, don't open the Simulator and start Visual Studio for Mac, then open a solution, I still have to go through the close/re-open solution steps... sometimes more than once. The simulator is not set to auto start or anything like that. But, at least, it's getting simpler, and takes less time, to get to a point where I can run an iOS app.
I have a Win10 computer paired with Mac. Until today all things were okay, but today I start getting the message:
Please select a valid device before running the application
when I try to debug an iOS Xamarin application on a selected iPhone simulator.
My configurations:
Mac:
OS: Mac OS Catalina, version 10.15.7
XCode Vesion: version 12.2
Visual Studio 2019: version 8.8.4 (build 30)
Win 10:
OS: Win10 version 10.0.19042.685
Visual Studio 2019: version 16.8.3
Simulator names are available on my Win10 computer, but when I select one and try to debug an iOS application I get the message I reported above.
If I launch debug on the Mac directly it runs and starts debugging on the selected iPhone simulator. But when I do the same on the paired Win10 computer in Visual Studio I get this message.
I searched google and SO for this issue and according to advises downgraded XCode to the most possible version 12.2 that is supported by Visual Studio. But it does not change anything.
I want to debug application only on simulator on the paired Win10 computer.
Is there a way to fix this issue?
Looks like the problem was related to the connection between my Win and Mac computers.
My steps to resolve this issue:
I opened Tools - Options - Xamarin - iOS Settings on Visual Studio on my Windows computer. On the Pair to Mac dialog window I selected "Forget this connection" (right click context menu on the connection).
Next, on my Mac, I turned off Sharing (System - Preferences - Sharing).
Then I restarted my Mac computer. And then turned On sharing again, specifying my username as allowed users.
Next on my Windows computer, in the Visual Studio, on the Tools - Options - Xamarin - iOS Settings section I paired my Mac again.
Voila. All things work as expected!
If anyone else runs into this question today, I found this GitHub issue for XCode 13 issues with Xamarin.ios
https://github.com/xamarin/xamarin-macios/issues/12778
I fixed the issue by manually installing xamarin.ios-15.0.0.6.pkg on my mac (linked in the GitHub issue)
When connecting to mac through visual studio it showed the error "The Xamarin.iOS SDK version '15.0.0.6' that is installed on the Mac is not compatible with this version of Visual Studio. Would you like us to install Xamarin.iOS '14.20.0.25' for you? This will overwrite any other existing Xamarin.iOS installation on your Mac."
But, if you hit cancel it should still connect successfully.
Same issue diff version. VS MAC stand-alone also had some issue as VS WIN connected to VS MAC. Started at some early today. Suspected an update somewhere. Traced issues to auto update of XCode to 13. Solution was to download and reinstall XCode 12.5.1 from Apple Dev site. With XCode 12.5.1 things worked. So, something changed with the API in XCode and Xamarin was not prepared for it.
Restarting Visual Studio in Windows worked for me after successfully building.
I have a Sony Xperia Z3 and I'm trying to debug an Apache Cordova application aka: Multi-device hybrid application on my device but visual studio builds and then opens adb.exe after the build is complete. It doesn't launch the application on my device although my device does prompt for verification.
I have developer options enabled on my device and I have USB debugging enabled.
I followed the steps on MSDN to debug an application on my device but it still doesn't work: http://msdn.microsoft.com/en-us/library/dn757059.aspx
I created a self signed keystore using the keytool in jdk and that works fine.
I have all of the necessary drivers installed and my device appears under the "adb devices" list of connected devices.
I tried deleting all the drivers and reinstalling them as well as updating them.
The ripple emulators work perfectly. It's just when I try to debug on a device.
well, that's a known issue with Cordova visual studio 2013 update. please see below blog for the known issue list for Cordova and search for adb on page. you'll get to know about this and there is no fix available for till now. please update me too if you find any :)
I'm pretty sure that you CANNOT debug a cordova visual studio project in an android DEVICE! The ripple emulators also are very limited, some plug-ins just simply DON'T work in the emulator!