Bug 44460 - ResolveLibraryProjectImports often fails not being able to delete
Summary: ResolveLibraryProjectImports often fails not being able to delete
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android Designer (show other bugs)
Version: 4.2.0 (C8)
Hardware: PC Windows
: --- normal
Target Milestone: 4.2.x (C8SR0)
Assignee: Jérémie Laval
URL:
: 44271 44459 44463 44465 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-09-17 16:09 UTC by Tomasz Cielecki
Modified: 2016-10-20 20:07 UTC (History)
10 users (show)

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


Attachments
logs for 4.2.0.684 (11.04 KB, application/x-zip-compressed)
2016-09-21 19:53 UTC, Ben Beckley
Details
logs for 4.2.0.684 (18.00 KB, application/x-zip-compressed)
2016-09-21 20:24 UTC, Ben Beckley
Details
logs for "something went wrong" popups (22.13 KB, application/x-zip-compressed)
2016-09-22 18:40 UTC, Ben Beckley
Details


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:
Status:
VERIFIED FIXED

Description Tomasz Cielecki 2016-09-17 16:09:36 UTC
When building an Android project, I often get errors ResolveLibraryProjectImports not being able to complete because it cannot delete folders in the obj folder or because a directory is empty.

Stack Trace:

2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018: The "ResolveLibraryProjectImports" task failed unexpectedly.
2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018: System.IO.IOException: The directory is not empty.
2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018: 
2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound)
2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1045,2): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

Seems like an exception is not being caught on your end during the build.

The other exception I am seeing is:

System.UnauthorizedAccessException: Access to the path 'D:\git\NSApp\src\NoiseSentinelApp.Droid\obj\Debug\__library_projects__\Location.Droid\library_project_imports' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.EnumerateFileSystemEntries(String path)
   at Xamarin.AndroidDesigner.DesignerProject.<>c.<GetExtraLibraryLocations>b__184_2(String d)
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Enumerable.<ConcatIterator>d__58`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Xamarin.AndroidDesigner.DesignerProject.GetExtraLibraryLocations()
   at Xamarin.AndroidDesigner.DesignerProject.<RefreshExtraLibraryLocationsIfNeeded>d__148.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.AndroidDesigner.DesignerProject.<NotifyProjectBuilt>d__174.MoveNext()

Deleting bin and obj folders manually helps, but this should really not be necessary...
Comment 1 Tomasz Cielecki 2016-09-17 16:10:03 UTC
Version info:

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01038

Installed Version: Enterprise

Architecture and Modeling Tools   00322-80000-00000-AA888
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Visual Basic 2015   00322-80000-00000-AA888
Microsoft Visual Basic 2015

Visual C# 2015   00322-80000-00000-AA888
Microsoft Visual C# 2015

Visual C++ 2015   00322-80000-00000-AA888
Microsoft Visual C++ 2015

Windows Phone SDK 8.0 - ENU   00322-80000-00000-AA888
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   7.6.00907.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.

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

GradleBindings.VisualStudio   1.0
Creates Xamarin Android Binding projects from a gradle file.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JetBrains ReSharper Ultimate 10.0.2   Build 104.0.20151218.120627
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2016 JetBrains, Inc.

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.40623.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.40623.00
Provides templates and integration for the Django web framework.

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

SQL Server Data Tools   14.0.60519.0
Microsoft SQL Server Data Tools

TypeScript   1.8.36.0
TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   14.0.25527.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin   4.2.0.680 (c4382f5)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.0.0.18 (0e59c36)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.0.0.6 (6c3fee4)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 2 dean.ellis 2016-09-19 13:45:33 UTC
*** Bug 44465 has been marked as a duplicate of this bug. ***
Comment 3 Jérémie Laval 2016-09-19 15:18:48 UTC
*** Bug 44271 has been marked as a duplicate of this bug. ***
Comment 4 xamarin-release-manager 2016-09-19 19:46:37 UTC
Fixed in version 99.0.0.3585 (master)

Author: J??r??mie Laval
Commit: 754470a05cca6a03a659d0a9cb33d2d26c1bb677 (xamarin/md-addins)
Included in Commit: b8fddd6fdb3164caae7be8859fc4267d8672fcf7 (xamarin/XamarinVS)
Comment 5 Jérémie Laval 2016-09-19 21:39:16 UTC
*** Bug 44463 has been marked as a duplicate of this bug. ***
Comment 6 Jérémie Laval 2016-09-19 21:40:50 UTC
*** Bug 44459 has been marked as a duplicate of this bug. ***
Comment 8 xamarin-release-manager 2016-09-21 16:37:16 UTC
Fixed in version 4.2.0.684 (cycle8)

Author: J??r??mie Laval
Commit: 87664001eaefd9ea8943a69a2b25188c2211f81a (xamarin/md-addins)
Included in Commit: c572194d16aa4296f93a422357cc6e07f1b484ec (xamarin/XamarinVS)
Comment 10 Ben Beckley 2016-09-21 20:24:05 UTC
Created attachment 17653 [details]
logs for 4.2.0.684

Retested with the proper build which is 4.2.0.684 (cycle8/c572194) and I am able to reproduce the issue.
http://screencast.com/t/KKjxdPuqW

Environment: https://gist.github.com/BenBeckley/e78d626163bd2a76eb026bd45aca2677
Comment 11 xamarin-release-manager 2016-09-22 16:06:32 UTC
Fixed in version 99.0.0.3603 (master)

Author: J??r??mie Laval
Commit: f83f3e664cfc9496692d7793055d1f36091ae864 (xamarin/XamarinVS)
Comment 12 Ben Beckley 2016-09-22 18:40:03 UTC
Created attachment 17690 [details]
logs for "something went wrong" popups

I have verified that I am no longer getting the "ResolveLibraryProjectImports" error after three attempts. Although, I did get an error popup and a "Something went wrong" popup after building. Didn't capture a screenshot of the first error popup, but here is the latter:

http://www.screencast.com/t/2qaVD9j9

Env info: https://gist.github.com/BenBeckley/84a13ed3bc86353116b7821b3bc22800
Comment 13 xamarin-release-manager 2016-09-22 19:21:22 UTC
Fixed in version 4.2.0.692 (cycle8)

Author: J??r??mie Laval
Commit: 46176fa0b83aeca194df98a73f90c39b35ea8bab (xamarin/md-addins)
Included in Commit: 59ad3dbe110673b0a99b70001346284cc5621a5c (xamarin/XamarinVS)
Comment 14 Ben Beckley 2016-09-22 19:31:59 UTC
Being that the popups are non-fatal and can be dismissed by reloading the designer or rebuilding, I am marking this as verified fixed.

Bug 44636 is tracking the aforementioned popup issue.
Comment 15 xamarin-release-manager 2016-09-22 19:53:10 UTC
Fixed in version 4.2.0.695 (cycle8)

Author: J??r??mie Laval
Commit: 23cc3514872cb895751d437701cef7642964792c (xamarin/XamarinVS)
Comment 16 xamarin-release-manager 2016-10-06 22:39:44 UTC
Fixed in version 4.2.0.743 (cycle8)

Author: J??r??mie Laval
Commit: c6620c454a794575bf18f2529ab33ec227f683fc (xamarin/XamarinVS)
Comment 17 dan@lexiconsystemsinc.com 2016-10-20 20:07:57 UTC
Workaround: Check your projects to see if there are any broken references. (marked with yellow triangle) Delete all broken references. Recompile.

For us, the bug is that VS improperly reports broken refs with this misleading  error '"ResolveLibraryProjectImports" task failed unexpectedly'.