Crashing in xamarin studio leading to corrupt files

AlexWhiteAlexWhite Alex WhiteGBMember ✭✭

This has been a problem for me from day one (well over a year ago), I have since purchased a brand new mac book pro and the problem still exists and is now causing a loss of work, the problem is this every now and again studio just hangs with the colourful swirly mouse cursor I am not doing anything specific it just happens, when this happens all I can do is kill the process, this then leads to the files being unstable when I next go in. Basically studio believes all the files have been modified by another process and this can very quickly lead to data loss, the attached image is one of the errors I get, the other is much more confusing and leads to blank source files if I am not very careful.

This is driving me mad as it has happened 5+ times already today.

I need some help before I start to lose significant amounts of work (I lost a couple of days work to this problem a month ago) it is not good enough to rely on backups as there is a fault in the product somewhere.

ATB

Alex

Screen Shot 2013-06-27 at 07.39.39.png
1198 x 322 - 88K

Posts

  • JeffreyStedfastJeffreyStedfast Jeffrey Stedfast USMember, Xamarin Team Xamurai

    Are you using any sort of version control system that is maybe changing the files? Are you using version control via Xamarin Studio? Or via the command-line?

    I get these dialogs a lot, too, but that's because I'm constantly changing git branches from a terminal rather than using Xamarin Studio's git integration (I should really use Xamarin Studio's git support, but muscle memory is hard to break).

    I never get these dialogs for any other reason, which is why I'm asking about version control that you may be using.

    If you aren't using version control, are you using any software which might periodically scan over your files and possibly change the mtime on them? Perhaps some backup software?

  • JeffreyStedfastJeffreyStedfast Jeffrey Stedfast USMember, Xamarin Team Xamurai

    Oops, sorry, I think I misread your post.

    You are saying this happens after Xamarin Studio hangs/crashes. Ignore my previous comment as it likely does not apply.

  • MichaelHutchinsonMichaelHutchinson Michael Hutchinson USModerator, Xamarin Team Xamurai

    Could you please obtain a trace of the hung process? To do this, when Xamarin Studio hangs, open a terminal, and run the command killall -QUIT XamarinStudio. This will not terminate Xamarin Studio, but will cause it to write stacktraces of all its threads to its log file.

    Then, please file a bug and attach the log file (from ~/Library/Logs/XamarinStudio-4.0) and full version details from the About dialog.

  • MichaelHutchinsonMichaelHutchinson Michael Hutchinson USModerator, Xamarin Team Xamurai

    Also, could you clarify what you mean by "the files being unstable when I next go in"? Does it happen as soon as you open the solution? For which files, all files that you open or just files that were open when it crashed? Are you using any kind of external source control?

  • AlexWhiteAlexWhite Alex White GBMember ✭✭

    No version control used at all, the only process touching the files is xamarin studio, I use no antivirus, no backup software (I backup manually when all applications are closed), the process is this, it seems to happen fairly often when I am setting breakpoints, clicking on the on the margin to the left of the code, the swirly cursor happens, I have left this overnight before to see if it is a long running process but it is not studio has got stuck in a loop and stops functioning, so I kill the process, the next time in studio opens the project, any file that was worked on that has not been autosaved (so has changes) will come up with the dialog that it has been modified outside of xamarin, there are two dialogs the one I posted and another one that has four options (can't remember them but will screenshot them next time), anyway whatever option you take seems to lead to the source files being blanked.

    Two things that can dig you out of the hole is, when this happens, don't save the changes when this happens then the original file is sometimes not overwritten, the other is to rename the file with ~ on the name to the original. Yesterdays crash was a bad one I totally lost the file and had the option of pulling it from a backup, I choose not too as the specific file has two versions one for iPad and one for iPhone with a few changes, so I got the iPhone one and recreated the iPad one from it, this was very lucky as this is the only iPad/iPhone combination source files I have, all the other files in the project are universal and only have a single instance.

    I will do the steps outlined in the post to capture the trace and open a bug report.

    This problem has been around for about a year, I can go weeks without an issue then hit the issue over and over ago in a few minutes.

    Thanks for the replies.

    ATB

    Alex

  • JeffreyStedfastJeffreyStedfast Jeffrey Stedfast USMember, Xamarin Team Xamurai

    Okay, well, the good news is that the breakpoint hang that you are hitting should be fixed in the next release. I'll see what I can do about getting you an internal pre-release build of git master (which has my breakpoint deadlock fixes) and post a download link here.

    Of course, that doesn't fix the issue you are having after restarting Xamarin Studio, but it should at least reduce the number of hangs you are having.

    I'll point our text editor guy, Mike Krueger, to this thread so he can look into the restore-from-autosave functionality.

    Most of the backtraces I've seen where there is a breakpoint hang have also had TextEditor threads autosaving file content. Usually these breakpoint hangs happen because the app being debugged hasn't finished starting up at the point where you start adding/removing breakpoints. There is/was a delicate timeframe in which adding/removing breakpoints was extremely likely to cause a deadlock and that is between the point where you hit the "Debug" button/menu item and when it finishes launching the app. IOW, if you add/remove breakpoints before hitting Run/Debug or after the app has finished launching, you're not likely to get a deadlock, but in between those 2 points, it is extremely likely to hit one.

    When you hit Run/Debug, it also causes all of the text editor tabs to auto-save and so my guess is that if you hit that deadlock before the autosave file finishes saving, then when Xamarin Studio starts up again, it may wrongly assume that the autosave files are complete and so when it restores from an autosave file, you end up with a corrupt/incomplete document.

    Does that make sense?

    We'll have to talk to Mike Krueger to know if my autosave file theory has any merit or not, but it seems reasonable to me as the culprit.

  • AlexWhiteAlexWhite Alex White GBMember ✭✭

    Hi,

    your summation is 100% right with what I think is going on, debugging works sometimes and not others leaving studio in a bit of a confused state, then switching on/off breakpoints and bang studio gets stuck, the autosave feature seems to be on a different thread so works but there seems to be confusion of what the latest file is when the deadlock occurs, so coming back into studio when this happens and studio believes something other than itself has modified the files.

    More than happy to try an internal build when one becomes available, one thing that is worth noting is there are a number of ~ files which suggests that the auto save features is not finishing??.

    Thanks for your post, I thought I was going mad.

    atb

    alex

  • JeffreyStedfastJeffreyStedfast Jeffrey Stedfast USMember, Xamarin Team Xamurai

    I've uploaded the most recent internal build with my breakpoint deadlock fixes here: https://files.xamarin.com/~jeff/XamarinStudio-450cd700a22395f7c7b1aaabfc7df513296ad35b.dmg

    This build also contains lots of other changes and hasn't been QA'd, but hopefully it hasn't introduced any new regressions. If you run into any regressions from 4.0.9, let us know, though, so that we can make sure they get fixed before we make a 4.0.10 (probably around the end of the month).

    The next public releases (4.0.10 and/or 4.1.5) should contain my debugger fixes. 4.1.5 will likely be out sooner than 4.0.10 since we're starting our final push toward 4.2 with the iOS designer.

    Hopefully we'll also figure out what causes the autosave problem you are seeing as well by then.

  • AlexWhiteAlexWhite Alex White GBMember ✭✭

    Thanks Jeff,

    I have just installed it, I am waiting for a complete backup to finish before I give it a hammering, I will give you feedback as soon as I have had a good play.

    Thanks again.

    ATB

    Alex

  • JeffreyStedfastJeffreyStedfast Jeffrey Stedfast USMember, Xamarin Team Xamurai

    No problem, looking forward to reading your feedback.

  • AlexWhiteAlexWhite Alex White GBMember ✭✭

    Got it to crash again with the new build, it looks like when you fire up a debugging session it puts the app onto the device but the debugging session is not fully connected to it, clicking on the margin to set a breakpoint then hangs the app.

    I ran the following command

    killall -QUIT XamarinStudio

    and have submitted a bug report with the hang file.

    https://bugzilla.xamarin.com/show_bug.cgi?id=12942

    hope it helps, I think I can get this to crash pretty much all of the time, so should be quite easy to pin down.

    atb

    alex

  • JeffreyStedfastJeffreyStedfast Jeffrey Stedfast USMember, Xamarin Team Xamurai

    I can't seem to get it to crash or deadlock. Are you sure you tested with the right version?

  • MagooCMagooC Min Choi AUMember

    This happens to me all the time also. On latest Beta. Every so often, when setting or removing breakpoints, Xamarin studio will hang. I have to force kill and restart.

  • reshmapopupreshmapopup reshmapopup USMember

    Hi, This is happening with me too. When I am adding any controls or any UI items on storyboard & then switch back to any of source code opened in studio. I am on mac. It's really frustrating , getting project timelines delayed just beacuse of xamarin studio is my current IDE. I am on INDIE subscription. I was planning to update my subscription version before. But currently I don't think I will do as I am facing so many problems working on xamarin as an IDE.

Sign In or Register to comment.