Skip to content

Occasionally encountering strange race condition or timing issue in ConvertResourcesCases #2043

Closed
@pjcollins

Description

@pjcollins

We're running in to a seemingly rare bug where the ConvertResourcesCases task will fail during various file operations. These appear to have some sort of threading, race, or timing aspect, as the exact error or reproduction is not consistent.

I've managed to narrow things down slightly on a single test machine where this seems to be happening more frequently. Using the steps below, I can somewhat consistently cause this task to fail when attempting to process items from lp/*/jl, all of which correspond to various Xamarin.Android.Support.* NuGet references in these templates. I managed to reproduce a couple of times on my local machine as well with these steps.

Given the results we have seen so far, this appears to be a regression introduced somewhere in xamarin-android/d15-9 + mono/2018-06 + monodevelop/release-7.7

Steps to Reproduce

  1. Create a new Android App -> Max Compatibility project in VS Mac. This should include version 27.0.2 of Xamarin.Android.Support.Compat.
  2. Click on Build -> Build All. The initial build should succeed).
  3. Right click on Packages -> Update. A minor version bump for these packages should be available (e.g. 27.0.2 -> 27.0.2.1).
  4. Click on Build -> Build All. This build attempt is failing for me during ConvertResourcesCases pretty consistently on a mac mini running Sierra.

Expected Behavior

ConvertResourcesCases successfully completes on build and subsequent build attempts after changing various references or project options.

Actual Behavior

ConvertResourcesCases fails intermittently when attempting certain file operations. The "culprit" file in question varies from repro to repro, and the exception does not always reflect the state of my intermediate output directory (e.g. FileNotFoundException thrown when the file does exist).

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1666,2): error MSB4018: The "ConvertResourcesCases" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1666,2): error MSB4018: System.IO.FileNotFoundException: Could not find file "/Users/xamarinqa/agent/_work/r15/a/XQA.VSMac/XQA.VisualStudioMac/TestResults/f6a9104b/TestAndroidEnableAOTEnterprise/Temp/DroidApp/DroidApp/obj/Release/lp/6/jl/res/layout/notification_template_custom_big.xml"
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1666,2): error MSB4018: File name: '/Users/xamarinqa/agent/_work/r15/a/XQA.VSMac/XQA.VisualStudioMac/TestResults/f6a9104b/TestAndroidEnableAOTEnterprise/Temp/DroidApp/DroidApp/obj/Release/lp/6/jl/res/layout/notification_template_custom_big.xml'
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1666,2): error MSB4018:   at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00259] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:274 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1666,2): error MSB4018: The "ConvertResourcesCases" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1666,2): error MSB4018: System.IO.IOException: Could not create file "/var/folders/44/n482q3wx171dnj8b6165rync0000gn/T/tmp5964ed16.tmp" or "/Users/xamarinqa/Projects/TestFin/TestFin/obj/Debug/lp/6/jl/res/values-en-rIN/values-en-rIN.xml". File already exists.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1666,2): error MSB4018:   at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1666,2): error MSB4018:   at Xamarin.Android.Tools.Files.CopyIfChanged (System.String source, System.String destination) [0x00027] in <85b0a2338aa04872b3b64fcf0b67c0bd>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1666,2): error MSB4018: The "ConvertResourcesCases" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1666,2): error MSB4018: System.IO.FileNotFoundException: /var/folders/zz/xvp_v21d0_qgnjn2xd4kqsrh0000gn/T/tmp3b73f1d.tmp does not exist
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1666,2): error MSB4018: File name: '/var/folders/zz/xvp_v21d0_qgnjn2xd4kqsrh0000gn/T/tmp3b73f1d.tmp'
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1666,2): error MSB4018:   at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111 

Version Information

https://gist.github.com/pjcollins/2dbe0b3beb7a61ffb84b7f6e8a2e712a

Log File

https://gist.github.com/pjcollins/f758cbbca74519af957fcaca5f4dc957
http://xqa.blob.core.windows.net/gist/log-0ae5db3450514d0d8dfc2f41a17141fc.txt
https://gist.github.com/pjcollins/c987b9044fbb556cf68dcbc3c7d22495

VS bug #660461

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.vs-syncFor internal use only; creates a VSTS "mirror" issue.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions