Xamarin iOS Simulator running old code

2019-02-09 04:28发布

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?

7条回答
来,给爷笑一个
2楼-- · 2019-02-09 04:51

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.

查看更多
做自己的国王
3楼-- · 2019-02-09 05:00

In my case I had to enable all architectures:

  • Android project properties
  • Andrid Oprions
  • Section Anvanced Tab
  • Select all architectures and rebuild
查看更多
贼婆χ
4楼-- · 2019-02-09 05:03

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.

查看更多
疯言疯语
5楼-- · 2019-02-09 05:05

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

查看更多
Evening l夕情丶
6楼-- · 2019-02-09 05:05

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

查看更多
够拽才男人
7楼-- · 2019-02-09 05:08

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

查看更多
登录 后发表回答