Forum Visual Studio


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Newest version of code not always deployed when debugging from Xamarin Studio



  • AleksandarLUKICAleksandarLUKIC USMember ✭✭

    I'm currently running on this problem.
    But for now, I didn't found a solution.

    What changed since it was working is that I was developping a Windows Phone version of my app and came back on the Android App to fix something.

    I don't have steps to reproduce but tell me if I can help Jon.

  • Slava87Slava87 UAMember

    I think I found out why this problem is happening. The reason is that in .Droid projects /bin and /obj folders remain busy by some processes even after deployment on the testing device is finished. And if one does a new build after short period of time either happens an error or and old version of build is used. If wait few minutes after the first build, then, during a new deployment everything works well and all functionalities are updated. I am just a very fresh beginner, so sorry if my comment is not relevant or not correct

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai
    edited February 2017


    Thanks for those observations. It might still help to get the info Dean Ellis asked for in this post on this thread.

  • baigzbaigz PKMember

    I have the same issue nothing so far have resolved my issue. I have followed all of the above mentioned trick. Please help it started to frustrate me.

  • NateVargheseNateVarghese USUniversity ✭✭
    edited February 2017

    I have this too. Its so annoying. It's been happening for at least a month now when archiving in Release mode.

    Attached the log Dean Ellis asked for. I had to change the extension to .txt because these forums don't seem to accept .log files.

  • DeanEllisDeanEllis USXamarin Team Xamurai

    Thanks for the data.

    If you look at the log there are allot of "SkipCopyFile" comments. If the file you modified has a SkipCopyFile next to it then it seems adb thinks that file did not change.

    The next step is to get the full diagnostic build output for the project. Along with the name of the assembly that was changed. That way I can take a good look at the logs. Alternatively you can do the whole thing from the command line

    msbuild /t:SignAndroidPackage /v:d > build.log
    msbuild /t:Install /v:d > install.log

    That will give us all the data we need. Note we do need to know which assembly/file was changed otherwise it makes it hard to see why things are not working.

  • JoeyZacherlJoeyZacherl USMember ✭✭
    edited March 2017

    So I have this issue every now and then. Usually nuking bin and obj directories solves it. Today, that's not the case. And to make things even more strange, it's building the latest code on Phone A but building old code to Phone B. Very strange.

    Here is my procedure.

    -Remove app from Phone A
    -Clean entire solution
    -Nuke /bin and /obj directores
    -Deploy to Phone A, phone a is running old code...

    -Remove app from Phone B
    -Clean entire solution
    -Nuke /bin and /obj directores
    -Deploy to Phone B, phone a is running the latest code fine

    Here are my Android Tools and IDE logs:


    I was able to resolve this by doing the following in terminal:
    cd /Users/myName/Library/Developer/Xamarin/android-sdk-macosx
    adb uninstall com.mycompany.myappname

    Looks like the app wasn't really removed from my device despite me doing an uninstall. And when deploying from Xamarin, it wasn't overwriting it.

  • JoeyZacherlJoeyZacherl USMember ✭✭
    edited March 2017

    I was able to resolve this by doing the following in terminal:

    cd /Users/myName/Library/Developer/Xamarin/android-sdk-macosx
    adb uninstall com.companyname.appname

    This fully removes the application from the device. My issue was that the app was not getting removed from the device despite me uninstalling. And Xamarin's deploy was not overwriting the old code.

  • AndyDentAndyDent AUMember ✭✭
    edited March 2017

    The problem still occurs Xamarin Studio 6.2 build 1829.

    Uninstalling is not always an option - it's normally my first point of uninstalling on the device. In my case I'm debugging a problem that occurs for people doing updates :-(

    Changes to resources are being detected and propagated to the app but old code was still being invoked.

    As you can see from the screenshot below, the runtime type of the object being created is different - it's an older version of the class. The visible effects on the Android device indicate that is indeed what is happening. Somehow, an old version of MainActivity is being invoked and creating the old object.

    Things tried which made no difference:

    • restart the device
    • deleting bin and obj folders,
    • delete the Library/Developer/Caches/XamarinStudio-6.0
    • turn off Fast Assembly Deployment
    • turn off Use Shared Mono Runtime
    • enable Generate one package per selected ABI

    Note that, after I suspected code changes were not being propagated, I renamed the class, its file and even refactored the code so that the work is done in a different method. The debugger as shown in the screenshot thinks it is iterating the new code but is creating an instance of the old object.

    Android Tools log attached

  • AndyDentAndyDent AUMember ✭✭

    In my case I'm changing one tiny file that's linked into a small test program, so there are no separate DLLs being changed.

    Simple changes to the MainActivity.cs are being ignored - the code in the main fragment is not being propagated to the device.

    So I bit the bullet and uninstalled the application:

    • Built and ran the replacement version to ensure that when run as a clean install, the expected logic is invoked.
    • Uninstalled the replacement
    • Went back and built and ran the original app.
    • Stopped the original.
    • Used the Application manager on the device to do a Force Stop of the original
    • Rebuilt the replacement.

    Now, trying to run the replacement, get a very interesting error:

    Detecting existing process
      am start -n "io.realm.testmigratefrom77_1droid/md50576fb6928abddee0e8c9d637bb1d306.MainActivity"
  • AdriVermeulenAdriVermeulen USMember

    The problem is solved for me after doing the steps in the link Stackoverflow answered by Yoruba.

  • BillDehortyBillDehorty USMember

    FWIW...I encountered a similar issue and a found a different work-around. (I am using VS2017 Community 15.2 Release 26430.6 + Xamarin + Xamarin.Android SDK In my case, I can never deploy my Android app more than once to the same Android Virtual Device in succession. The second and all subsequent attempts to the same virtual device will hang on the deployment. The emulator starts, and my app is installed in the emulated device, but the app won't start, and VS just hangs at the deployment step. To work around this, I created a second Android Virtual Device that is essentially identical to the first. As long as I keep toggling between the two virtual devices on every redeployment, the deployments succeed.

  • TigerLionCheetahTigerLionCheetah CAMember ✭✭

    [Really, really annoying. Bugs [[features]] like these make life "interesting", like hitting your finger with a hammer to forget you have a headache....] Anyway, again, thanks.


  • ahmeddriraahmeddrira USMember

    hey guys any news??

  • AlanJonesRiosAlanJonesRios USMember ✭✭

    So, here is my experience:

    I moved my project from one pc to other, then I got the same issue like everyone. It seems to me that VS have problems to deal with moved projects some times.
    All issues was been fixed when I erased bin and obj from android and ios projects.

  • M_AllanM_Allan USMember ✭✭

    I think the leader of Xamarin team need to leave.

  • jjtudujjtudu Member ✭✭

    time sync, had resolved my issue.
    Me dugging in device.

  • BlakeWillsMCBlakeWillsMC GBUniversity

    @DeanEllis - I'm getting this intermittently on the latest version of VS Enterprise (15.5.2) and Xamarin version Uninstalling the app from the device and re-deploying seems to be the only work around at the moment.

    What VS logs do you need to diagnose the issue? From the Help > Xamarin > Open Logs directory, I can see four types of log file (xxx.Ide.log, xxx.XamarinLive.log, inspector-xxx.log and monodroid-xxx.log). - I'm guessing it's monodroid that you want. (See attached)

    Going back to one of your earlier comments:

    For background, when FastDev is enabled (which you should use when debugging) the app on the device will only be updated if resources have changed. If you only change C# code the assemblies will be moved to a special directory which in the installed app picks up.

    I had a look in the monodroid log file, and can see the following:

    MonoDroidLog: Information: 0: [D:NotifyPhase]:          Uploading files
    MonoDroidLog: Information: 0: [D:NotifySync]:           CopyFile C:\MyApp\MyApp.Droid.Service\obj\Debug\android\assets\MyApp.Service.dll /storage/sdcard/Android/data/com.microlise.MyApp.service/files/.__override__/MyApp.Service.dll 98304
    MonoDroidLog: Information: 0: [D:NotifySync]:           SkipCopyFile C:\MyApp\MyApp.Droid.Service\obj\Debug\android\assets\MyApp.App.dll /storage/sdcard/Android/data/com.microlise.MyApp.service/files/.__override__/MyApp.App.dll 49664
    MonoDroidLog: Information: 0: [D:NotifySync]:           SkipCopyFile C:\MyApp\MyApp.Droid.Service\obj\Debug\android\assets\MyApp.dll /storage/sdcard/Android/data/com.microlise.MyApp.service/files/.__override__/MyApp.dll 98816

    The MyApp.Service.dll is the main android project, MyApp.App.dll is a portable class library containing Xamarin Forms views and view models, and MyApp.dll is another portable class library, but only contains shared business logic. (Although it does have a ref to Xamarin.Forms)

    In this particular instance, I made changes to four files in the MyApp.App.dll project (two .xaml files, two .cs files), and made further changes to one .cs file in the MyApp.dll project. No changes were made to the android project. (MyApp.Service.dll)

  • knocteknocte GBMember ✭✭

    Where's the proper place to file this issue? github or bugzilla?

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai


    Depends on what exact product. When you get to the "Select product page" on bugzilla when filing a new bug, you will get redirected to Github if the product you select has moved to github issues.

  • knocteknocte GBMember ✭✭

    Well, my question is, what product should I file it in? Not sure if VS4Mac or Xamarin.Android.

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    File it against the IDE, but in bugzilla it is still Xamarin Studio.

    For component, select General.

  • BlakeWillsMCBlakeWillsMC GBUniversity

    @JGoldberger @knocte Was this issue logged in bugzilla? I can't find it.

  • AlexanderLysenkoAlexanderLysenko USMember ✭✭

    I still face with this issues, but on Visual Studio 2017 (Windows)
    I do not want to clean up everything (bin, obj, etc. ) uninstall my app each time when I need debug, all this increase time of development in 2 times.
    I wonder whether anybody from Xamarin team at least tried to fix the issue. Now it seem that Microsoft doesn't care which problems Xamarin developers face with.

  • abdullahtahan.7433abdullahtahan.7433 SAMember ✭✭

    recently i'm having the issue only in one of my projects which working fine before but still don't know how to fix the issue i have to rebuild the all project every time to get the changes

  • abdullahtahan.7433abdullahtahan.7433 SAMember ✭✭

    ok i was getting this message when try to rebuild :
    'Could not resolve this reference. Could not locate the assembly ' what i did clean then delete the reference from android project of the shared or .net standard project then rebuild after rebuild i receive new message that can't find the reference of the main project i add the reference again then the issue gone now i can see my changes without rebuild

  • FadiHaniFadiHani USMember ✭✭
    edited July 2018

    I was facing this issue when working on a Xamarin.Android project with PCL in Visual Studio 2017 and running the app on my connected Samsung Galaxy S5.
    I noticed that sometimes when I changed some code in a Xamarin.Android class and deployed the changes, they wouldn't reflect on the device the first time and I'd need to deploy them again to have them reflect. Other times it would work normally.

    I found that if I edited a .cs file and immediately ran CTRL+F5 (without saving the changes) the changes wouldn't be reflected on that deploy (even though deploying should also save and rebuild changes).
    If I saved the changes (CTRL + S) then ran CTRL + F5 the changes would be immediately reflected normally.
    This might not be what most of you are facing but it might help someone.

  • FadiHaniFadiHani USMember ✭✭

    Actually I take that back. Saving the file manually seems to not work anymore (at least when I set the phone's "Automatic date and time" back to "checked").

    • I had previously removed the phone's Automatic time setting in an effort to investigate the problem. It could be a combination of both the manual save as well as manual time setting that will work. I will report back if it does.
  • FadiHaniFadiHani USMember ✭✭

    Manually saving the edited file still doesn't work even though I had tested it multiple times before posting my first comment.
    @JGoldberger I have attached my logs. Would you be able to help?

    There are some SkipCopyFile commands but those are all for files that have not changed. The files that do change i.e. GulfHR.Android are copied so that's fine.

    What I noticed however is that on some runs/deploys those commands are not invoked at all.
    When comparing runs, I see that sometimes only a subset of commands are logged (like line 1070 - line 1076 were from 1 deploy) while other runs/deploys have longer logs (like line 1077 - line 1152 where from another deploy).
    Does that help/make sense?

  • FadiHaniFadiHani USMember ✭✭

    sorry here's the log file.

  • ClovyClovClovyClov Member ✭✭

    Had this issue all day, oddly setting to "Release" fixed it but every time after I try to use debug and the old app shows. Very frustrating.

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    @FadiHani @ClovyClov

    Can you both try turning off Fast Deployment and uninstalling the App from the device?

    Apparently fast deployment might not work on some devices according to

    Fast deployment is known to fail on devices which block adb from synchronizing to the directory /data/data/@[email protected]/files/.override.

    And there is this logged issue:

  • Hello,

    Apparently I have the same problem as everyone else here. I get the issue of some files not being updated during a redeploy. Rebuild, deleting obj/bin folders, uninstalling the app from the phone(testing on actual device, an Honor 8 Pro) does nothing. Weirdly, it's an issue only with one of the files which contains some common settings for my application - URLs of the Backend, as well as some Terms and Conditions checks. I can use the app normally if I deploy the app and clear all Application Data directly on the phone, but that means I cannot debug. It seems like the Cache of the app is being uploaded during every run of the app, and it is using an old version of the data for some reason. I have tried finding where this cache is being kept, but no success so far. It seems like this issue started appearing when I fiddled with the Retain Application Data option in Visual Studio 2017, but I do not know where it keeps that cache and how it redeploys with it. If someone could point me to where this cache is that might resolve my issue.

    Best regards

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai


    This sounds like a different issue than what was described as it is an issue with application data it would seem, and is only an issue with a specific file.

    What type of app is it that is having this issue, Xam.Android, Xam.iOS, or Xam.Forms, and if Xam.Forms, what platform is issue occurring on?
    What type of file is it?
    What is the build action of the file?
    How is the file used, i.e. how are you using and storing the info in the file?
    Can you share the file?

    It would also help to get the info requested by Dean Ellis in this post:

    If you can't share the above publicly, you can open a free email support case so we can exchange files securely and privately. You can open a free Xamarin support case here:

  • Hey, thanks for reaching out with these requests for information. Let me clarify on as many of those points as possible:
    The app I have is a Xamarin.Forms one, where the issue I'm experiencing is only on Android.
    The file that is causing me grief is an AppSettings.cs file, a regular C# class that uses the Xam.Plugin.Settings NuGet to save some data locally. The main property that is causing me grief is a RefreshToken that I set on the initial login in the app and it is , for some reason, loaded from an old version that validates against a wrong Authority URL(my user login logic is based on OpenId and IdentityServer4).
    As this is a regular C# class file, the BuildAction is C# Compiler.
    As noted above, the file is using the Xam.Plugin.Settings NuGet to save its data. My guess is that for some reason Visual Studio is keeping an old version of these settings and is for some reason restoring those on every deploy to the device. I have not tried reinstalling Visual Studio yet as I have not had the time - I have a workaround to run the app on Android(no debugging) and I can properly debug on iOS.
    The file is something like this:(omitting actual values)

    public class AppSettings : IAppSettings
            private ISettings Settings => CrossSettings.Current;
    #if DEBUG
            public string ApiUrl => Settings.GetValueOrDefault(nameof(ApiUrl), "somelocalURL");
            public string Authority => Settings.GetValueOrDefault(nameof(Authority), "somelocalURL");
            public string AppCenterKey => Settings.GetValueOrDefault(nameof(AppCenterKey), "");
            public string ApiUrl => Settings.GetValueOrDefault(nameof(ApiUrl), "somedevurl");
            public string Authority => Settings.GetValueOrDefault(nameof(Authority), "somedevurl");
            public string AppCenterKey => Settings.GetValueOrDefault(nameof(AppCenterKey), "");
            public string ClientId => Settings.GetValueOrDefault(nameof(ClientId), "SomeClientId");
            public string ClientSecret => Settings.GetValueOrDefault(nameof(ClientSecret), "SomeClientSecret");
            public string Scope => Settings.GetValueOrDefault(nameof(Scope), "somescopes");
            public string RedirectUri => Settings.GetValueOrDefault(nameof(RedirectUri), "somecallback");
            public string DbPath => Settings.GetValueOrDefault(nameof(DbPath), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "somedb.db3"));
            public bool HasReadTermsAndConditions
                get => Settings.GetValueOrDefault(nameof(HasReadTermsAndConditions), false);
                set => Settings.AddOrUpdateValue(nameof(HasReadTermsAndConditions), value);
            public string RefreshToken
                get => Settings.GetValueOrDefault(nameof(RefreshToken), string.Empty);
                set => Settings.AddOrUpdateValue(nameof(RefreshToken), value);
  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai


    Hmm, interesting. I suspect the issue is that the settings are maintained on the device. Are you making sure to run the code that sets the settings every time the app is launched, even if the setting has already been set during a previous run of the app?

    Visual Studio should not be saving any of these settings itself, but you might try turning off the Fast deployment option as that should reset the app settings on the device for each deploy. With Fast Deployment set, it may preserve the old settings. Not nearly 100% certain on the exact reason as I am not very familiar with how the plugin works behind the scenes, but it should be storing the settings on device in a location for application data, which should be preserved between deploys if the Fast Deployment option is set.

    Let me know if that helps.

  • @JGoldberger
    Hey, sorry for not answering for these few days. And, sadly, this does not fix my issue - I had already tried it before this. Fast Deployment is off, Visual Studio's "Preserve App Data during Debug" is also off, but the data is still preserved. I think it's Visual Studio doing something as I completely remove the app from the device before trying to deploy it again. My main issue is that the RefreshToken property should be preserved between app launches, but it's being preserved beyond that, like it's being loaded from somewhere on deploy. I have tried going through the files on my device trying to find any leftover data after the app has been uninstalled, but no luck so far. For all I know, everything has been removed.

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    OK, then it would help to get the build log and other info requested by Dean Ellis in this post:

    The build log should show wha files are being compiled and which are being skipped, which will help us isolate if it is a problem with the changed file not getting recompiled or something other issue. Of course make a change to the file before building and collecting he build log.

    If you can't share the above publicly, you can open a free email support case so we can exchange files securely and privately. You can open a free Xamarin support case here:

Sign In or Register to comment.