10

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?

Calvin Fisher
  • 4,653
  • 5
  • 36
  • 47

7 Answers7

7

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

Cheddar
  • 4,680
  • 1
  • 19
  • 10
  • 1
    This is closest to what seems to have been working for me so far -- manually doing a Rebuild Project after making changes. I've also noticed that if you change project A and project B depends on project A, I have to rebuild A, then rebuild B. – Calvin Fisher Jul 18 '13 at 14:59
  • I'm having the same issue but on the Android side, it's clearly running old code even though I've tried rebuild / clean / deleting bin/obj / restarting xamarin studio / restarting my computer. What gives?? – Justin Aug 05 '14 at 13:54
  • I have the same issue, is there any workaround other than deleting the bin and obj folders every time? – Mina Wissa Feb 03 '15 at 15:36
  • For Android, if you already followed @Adam below, I often need to manually uninstall the app from the Android simulator. – hvaughan3 Sep 25 '15 at 22:17
3

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.

Adam
  • 16,089
  • 6
  • 66
  • 109
2

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

Rolf Bjarne Kvinge
  • 19,253
  • 2
  • 42
  • 86
1

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

Mina Wissa
  • 10,923
  • 13
  • 90
  • 158
1

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.

Mario Mucalo
  • 597
  • 5
  • 16
0

In my case I had to enable all architectures:

  • Android project properties
  • Andrid Oprions
  • Section Anvanced Tab
  • Select all architectures and rebuild
Ludwo
  • 6,043
  • 4
  • 32
  • 48
0

I still have this problem with iOS simulators. My solution:

  1. Unload the iOS project
  2. Reload the iOS project
  3. Build as usual

I do the above when I change simulator device.

JKapsi
  • 20
  • 5