Bug 51165 - Xamarin iOS DocSync Boot Failure
Summary: Xamarin iOS DocSync Boot Failure
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 4.3.0 (C9)
Hardware: PC Windows
: Normal normal
Target Milestone: 15.4
Assignee: Bugzilla
Depends on:
Reported: 2017-01-02 04:23 UTC by Mark Rucker
Modified: 2017-08-08 19:26 UTC (History)
6 users (show)

Is this bug a regression?: ---
Last known good build:

VM With Boot Failure and Timestamp (130.56 KB, image/png)
2017-01-02 04:23 UTC, Mark Rucker

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Mark Rucker 2017-01-02 04:23:27 UTC
Created attachment 19047 [details]
VM With Boot Failure and Timestamp

After iOS DocSync runs, if a Windows user runs Disk Cleanup they will see a large Temporary File listing. If a user then tries to delete these files the computer will likely no longer boot on the next restart. Either that or the Disk Cleanup shortcut will be removed or the Antivirus will no longer work or Visual Studio will no longer work. Some combination of those four.

I've successfully reproduced this bug in a VM. Follow the steps below to reproduce.

1. [Install VMWare Workstation Player 12.5](http://www.vmware.com/products/player/playerpro-evaluation.html)
2. [Download Microsoft's Enterprise Evaluation VM](https://developer.microsoft.com/en-us/windows/downloads/virtual-machines)
3. Open up Micosoft's VM in VMWare (the VM comes pre-installed with VS2015)
4. [Install Xamarin for VS on the guest machine](https://www.xamarin.com/download)
5. Create an iOS project (I created a blank watchOS app)
6. Wait for iOS DocSync to finish (in my testing you don't actually have to wait but in my final steps I waited)
7. [Open up Disk Cleanup](https://en.wikipedia.org/wiki/Disk_Cleanup)
8. Select Temporary Files and don't elevate to "Clean up system files" (if Temp Files isn't select or you elevate it won't break)

What happens after those steps is random. About 50% of the time the computer no longer boots. 75% of the time Disk Cleanup will be uninstalled. 50% of the time Windows Defender will no longer run. 50% of the time Visual Studio no longer opens. In my test run tonight my VM stopped booting on the first try. Assuming Disk Cleanup isn't uninstalled, and your VM still boots, you can repeatedly restart and run Disk Cleanup again until your machine no longer boots. Should only take once or twice in my experience. I've attached as screenshot from my VM tonight with the timestamp.

Also, I've had this issue chase me across three laptops and four versions of Windows. I have had this problem on a Dell Latitude E6430, an HP Elite Book 8560w and a Dell XPS13 9360. And I have had this issue on Windows 7 Home, Windows 7 Professional, Windows 10 Home and Windows 10 Enterprise.

I first noticed this problem on November 14th, 2016 on the Dell Latitude E6430.
Comment 1 Jose Gallardo 2017-01-03 18:37:11 UTC
Hi Mark,

I would assume you're using latest stable ( when hitting this issue, but can you please add specific environment information to help us investigate it?

In case it's not, please let us know the exact XamarinVS version (while you have a working system, please go to the menu "Help - About Microsoft Visual Studio" and press "Copy Info". Please paste that info into a Bugzilla comment).

Also, given that this is a system level issue, can you please let us know what exact Windows version / edition do you have installed?

For more context, Xamarin iOS DocSync relies on BITS for downloading the docs: https://msdn.microsoft.com/en-us/library/windows/desktop/aa362708(v=vs.85).aspx
which is a background system service. 

I'm assigning this issue to Mauro, who will be able to investigate further.

Comment 2 Mark Rucker 2017-01-03 19:24:58 UTC
Sure, happy to. I used the Xamarin install from your site, which I got yesterday.

For the time being I've uninstalled Xamarin from all my Windows machines. I realize this is likely a bug, but it simply acts too much like a virus for me to feel comfortable. I'm doing all my development from Mac until this is resolved.

###Devlopment Environment###

Microsoft Visual Studio Community 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Community

Visual Basic 2015   00322-20000-00000-AA840
Microsoft Visual Basic 2015

Visual C# 2015   00322-20000-00000-AA840
Microsoft Visual C# 2015

Visual C++ 2015   00322-20000-00000-AA840
Microsoft Visual C++ 2015

Windows Phone SDK 8.0 - ENU   00322-20000-00000-AA840
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   7.15.01215.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 (Beta8)   14.1.11107.0
ASP.NET and Web Tools 2015.1 (Beta8)

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

Command Bus, Event Stream and Async Manager   Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

Common Azure Tools   1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.4.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Python Tools for Visual Studio   2.2.40825.00
Python Tools for Visual Studio provides IntelliSense, projects, templates, Interactive windows, and other support for Python developers.

Python Tools for Visual Studio - Django Integration   2.2.40825.00
Provides templates and integration for the Django web framework.

Python Tools for Visual Studio - Profiling Support   2.2.40825.00
Profiling support for Python projects.

SQL Server Data Tools   14.0.60519.0
Microsoft SQL Server Data Tools

TypeScript tools for Visual Studio

Xamarin (47830f6)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (ce955cc)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS (44931ae)
Visual Studio extension to enable development for Xamarin.iOS.

###Windows Environment###

I've had this problem on four different systems

Dell Latitude E6430 Windows 7  Professional 64 bit
HP Elite Book 8560w Windows 7  Professional 64 bit
Dell XPS13 9360     Windows 10 Home         64 bit
Dell XPS13 9360     Windows 10 Enterprise   64 bit
Comment 3 Mark Rucker 2017-01-10 16:24:34 UTC
Just wanted to ping to see if there was any more info on this issue. Thanks!
Comment 4 mag@xamarin.com 2017-01-10 16:54:47 UTC
Thanks Mark.
I will be taking care of the issue soon. It's mostly related to the long file names that the Apple Docs has once they are extracted from the downloaded .dmg file, which generates some issues with the Windows file system, specially on deletion process because of the path lenght limitations.

I need to analyze the issue in depth to provide a permanent solution that doesn't generate any unwanted behavior like the one you are having.

We will update the issue and let you know once we have a proper fix.
Comment 5 Mark Rucker 2017-01-10 17:11:24 UTC
Thanks Mauro,

Once you have an opportunity to examine the issue, even if you can only let me know that this isn't malicious in anyway that would be great! I can't imagine it is, but when my machine begins removing components and then stops booting after I remove temp files I get very nervous.

Once I know it's only a bug I can at least install onto a VM and continue to work in VS, my IDE of choice by far. Also, as a professional developer myself, I've never seen a bug quite like this. I don't envy your task of trying to isolate and fix. If I can help at all, please don't hesitate to let me know.

Best of luck
Comment 6 Mark Rucker 2017-01-23 23:01:04 UTC
Hi Mauro,

I hope you've been well. 

I just wanted to check in again to see if there was any news on this issue.

I'm continuing to do all my development on a Mac, and I would love to move back.


Comment 7 mag@xamarin.com 2017-01-25 20:53:42 UTC
Hi Mark,

I can confirm you that this is indeed a bug with the DocSync tool. 

What happens is that as part of the process of adding Apple documentation on the Xamarin iOS API, we download a .dmg file with all the latest Apple API doc and we extract the contents of the .dmg file to then use the .xml documentation files to parse and generate the documentation for the .net assemblies.

The problem starts after the extraction of the .dmg file content, given that we preserve full file paths, and the paths inside the .dmg are very very very long in some cases, which generates a violation of the max path length (MAX_PATH) allowed for Windows, which is 260 characters.

That violation makes the OS to warn and not allow to do some operations with those files, like deleting them. That's why when the Disk Cleanup tries to clean those files, it fails and remains in a faulted state affecting the entire system. I don't know exactly how the Disk Cleanup is handling this error, that generates the system failure, but I'm sure that it's caused by that OS violation.

You can verify this manually after DocSync has run and without using Disk Cleanup, but doing instead a manual delete of this folder: %LOCALLAPPDATA%\Temp\Xamarin\DocSync.

If DocSync has completed, you will see that you can't delete the hole folder because of the mentioned OS violation. That's exactly what Disk Cleanup is getting.

That said, you don't need to worry about any malicious thing making damage to your computer. Just by no running Disk Cleanup over that folder would be enough until we can get a permanent and appropriate fix for this.

Also, it's supposed that with Windows 10 you can disable this MAX_PATH restriction, so a good workaround for users with Windows 10 would be to do it. To disable it you need to do:

1 - Open Group Policy Editor (gpedit.msc).
2 - Navigate to: Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem.
3 - Click Enable Win32 long paths and set the value to Enabled.

Anyways and independently of the workaround that you choose, no malicious thing is present here, just a tricky bug as a consequence of using a .dmg file, not meant to be used directly on Windows.
We will be working on a fix and let you know once we have more news.
Comment 8 Mark Rucker 2017-01-26 03:29:32 UTC
Thanks Mauro! That's all I needed to know. 

I just get nervous when deleting temp files downloaded by an app crashes my machine.

I'll set up a VM and do all my Xamarin development out of there until you guys have a permanent fix.

Again, thank you so much for the attention and response!


Comment 9 mag@xamarin.com 2017-08-08 19:26:08 UTC
An OS bug, non Xamarin related, was found and fixed; which was causing the disk cleanup to let the machine in an unrecoverable state because of the above mentioned MAX_PATH violation.

Also, from the next 15-4 release, DocSync will be disabled by default, by requests of many users, and configurable in the Tools > Options > iOS settings.

For these two reasons, we can consider this issue as Resolved.