Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin iOS Simulator running old code

When I debug my Xamarin.iOS project from Visual Studio, it builds, installs on the simulator, and launches the app without issue. But on launching, I'm seeing a bunch of Debug tracing from a method that doesn't even exist in my C# code anymore. I can also set breakpoints on the class from which I removed the method at the same line numbers where this method used to be, and I will see the removed method in the call stack when the debugger stops.

I've closed and reopened Visual Studio, reset the connection to the Mac build server, cleaned and rebuilt my solution, and manually deleted the solution output. On the Mac, I've closed and reopened the simulator, and tried Reset Content and Settings, which does clear out the app. But the situation still persists, even after all that. Is there something else can I try on the Mac to make sure that all cached copies of old code have been deleted?

like image 733
Calvin Fisher Avatar asked Jun 06 '13 23:06

Calvin Fisher


5 Answers

Check your Configuration Manager (the drop down with Debug, Release etc) and check that all the projects are being built. It usually unchecks all the projects you are working with for some unknown reason.

This means that it isn't rebuilding all the projects and it hence shows an old version.

As per your comment of rebuilding each project, this is a classic sign of the projects not being checked to be built on run and why you have to do it manually.

like image 59
Adam Avatar answered Nov 01 '22 15:11

Adam


I had a similar problem (though on an Android emulator).

What didn't work for me:

  • restarting the computer
  • restarting Visual Studio
  • deleting bin / obj folders
  • going into Configuration Manager (Debug / Release / Configuration Manager) and ticking everything there - everything was ticked
  • changing the version of the app in the manifest

What worked for me?

Uninstalling the app from the emulator and then running Debug again. It was an Android emulator, so I uninstalled by clicking on the app icon and holidng for long, and then dragging it to "Uninstall App". On an iOS simulator it should be similar.

like image 43
Mario Mucalo Avatar answered Oct 11 '22 06:10

Mario Mucalo


In your project folder delete the bin and obj folders. This works for me but is still annoying.

like image 7
Cheddar Avatar answered Nov 01 '22 14:11

Cheddar


In the iOS Simulator (on the Mac) click the "Reset Contents and Settings" entry the main menu.

like image 2
Rolf Bjarne Kvinge Avatar answered Nov 01 '22 15:11

Rolf Bjarne Kvinge


Well this worked with my Android project suffering from the same issue:

  1. Right click on Android project then select "Properties".
  2. Select "Android Options" then "Packaging".
  3. Un-check the "Use Shared Runtime" options.

then it worked normally

like image 1
Mina Wissa Avatar answered Nov 01 '22 15:11

Mina Wissa