Bug 36190 - [XVS 4.0] Could not write lines to file "obj\Debug\MyLib.csproj.FileListAbsolute.txt". The process cannot access the file 'C:\MyLib\obj\Debug\MyLib.csproj.FileListAbsolute.txt' because it is being used by another process.
Summary: [XVS 4.0] Could not write lines to file "obj\Debug\MyLib.csproj.FileListAbsol...
Status: CLOSED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: General (show other bugs)
Version: 4.0.0 (C6)
Hardware: PC Windows
: High major
Target Milestone: C6SR0
Assignee: Bugzilla
URL:
: 35848 (view as bug list)
Depends on: 35850
Blocks:
  Show dependency tree
 
Reported: 2015-11-24 00:21 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2017-04-24 10:38 UTC (History)
10 users (show)

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


Attachments
Xamarin.Common.targets workaround (2.02 KB, application/octet-stream)
2015-11-24 00:21 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details

Description Brendan Zagaeski (Xamarin Team, assistant) 2015-11-24 00:21:40 UTC
Created attachment 13961 [details]
Xamarin.Common.targets workaround

[XVS 4.0] Could not write lines to file "obj\Debug\MyLib.csproj.FileListAbsolute.txt". The process cannot access the file 'C:\MyLib\obj\Debug\MyLib.csproj.FileListAbsolute.txt' because it is being used by another process.


This is an intentional duplicate of Bug 35848 and non-public Bug 35850 for public tracking purposes.




## Possible workarounds


### Option 1: modify `Xamarin.Common.targets` by hand


1. From an administrator command prompt, open:
> C:\Program Files(x86)\MSBuild\[4.0|12.0|14.0]\Microsoft.Common.Targets\ImportAfter\Xamarin.Common.targets

2. Edit lines 27-30, and add the following attribute to the `<WriteLinesToFile>` element: ContinueOnError="WarnAndContinue"



After the change, the full text of the element will be (remove the > greater-than character from the beginning of each line):
> 		<WriteLinesToFile
> 			File="$(IntermediateOutputPath)$(CleanFile)"
> 			Lines="@(BuiltProjectOutputGroupKeyOutput -> '%(FullPath).mdb');@(BuiltProjectOutputGroupKeyOutput -> '%(FinalOutputPath).mdb')"
> 			ContinueOnError="WarnAndContinue"
> 			Overwrite="false" />




### Option 2: download the modified `Xamarin.Common.targets` and copy it into place


Download the attached "Xamarin.Common.targets workaround" file, and copy it into the following location:

#### For Visual Studio 2015
> C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.Targets\ImportAfter

#### For Visual Studio 2013
> C:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.Targets\ImportAfter




### Option 3: temporarily disable parallel project builds in VS

Under "Tools -> Options -> Projects and Solutions -> Build and Run" set "maximum number of parallel project builds" to 1.

(Options 1 or 2 are recommended over this option. This option is mentioned mostly just for illustrative purposes.)




## Regression status: regression between XamarinVS 3.11 and XamarinVS 4.0

The regression status is based on the volume of new reports of the issue from
customers starting in XamarinVS 4.0 compared to the absence of reports in
XamarinVS 3.11.




## Approximate steps to reproduce

1. Build a Xamarin.Forms Android or iOS app project that references a PCL project with many source files. (It is necessary that the PCL project is large enough that it takes a little while to build so that the "parallel builds" feature has a higher chance of being active while the project is building.)

2. Modify one of the files in the Xamarin.Forms solution.

3. Build again.




## Results

Sometimes the build fails with the following error:

> Could not write lines to file "obj\Debug\MyLib.csproj.FileListAbsolute.txt".

> The process cannot access the file
> 'C:\MyLib\obj\Debug\MyLib.csproj.FileListAbsolute.txt' because it is being
> used by another process.
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2015-11-24 00:27:04 UTC
## Status update

A candidate fix for this issue has been written by the Xamarin engineering team. The fix is tentatively targeted for release to the Alpha channel during this week (the week of November 23).
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2015-11-24 00:30:18 UTC
*** Bug 35848 has been marked as a duplicate of this bug. ***
Comment 3 Boris Spinner 2015-11-24 05:30:54 UTC
For me the workaround is NOT working.

Killed VS2015, made the change to the targets file; deleted .vs, bin and obj directories, restarted vs2015...
And building worked once. Second time the errors came up again (which should be ok, looking at the workaround) but ignoring it didn't help. Now it just says "deploying" forever and does nothing?

Am I doing something wrong here?
Comment 4 Boris Spinner 2015-11-24 05:33:17 UTC
(Talking about option 1 & 2 here... sorry, can't edit my comment)
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2015-11-24 15:42:18 UTC
> "deploying" forever and does nothing

That sounds like it might be a separate problem, unless I'm misunderstanding how the errors are appearing in your output. I'd recommend starting a new bug report [1] including your complete diagnostic build output and "Help -> Xamarin -> Zip Logs" files, or getting in touch via "Business & Enterprise Support" [2] for additional troubleshooting.

> [1] https://bugzilla.xamarin.com/newbug?release=C6
> [2] https://xamarin.com/support
Comment 6 Brendan Zagaeski (Xamarin Team, assistant) 2015-11-25 03:28:51 UTC
## Status update

- Fixed on the Alpha Channel

The candidate patch for this bug (that applies the workaround from comment 0 "automatically") is now included in the November 24 Alpha Channel "Cycle 6 – Service Release 0" release [1].

> [1] https://releases.xamarin.com/alpha-preview-cycle-6-service-release-0/
Comment 7 Derek Beattie 2015-12-08 23:43:33 UTC
This still happens with 4.0.132 with the changes made to Xamarin.Common.targets.
Comment 8 Boris Spinner 2015-12-09 08:28:07 UTC
Yup, same here. Only "fix" is Option 3.
Comment 9 Brendan Zagaeski (Xamarin Team, assistant) 2015-12-09 15:04:56 UTC
To be certain of the current behavior that users are still observing, the patch for this issue in theory _changes_ the error to a warning, allowing the build to continue despite the message, unless the build process is locally configured to fail on warnings.


For Comment 7 and Comment 8, are you still seeing _errors_, or are the messages appearing now as warnings?


If the precise symptom you are seeing is not a message that matches up with the text listed under "Results" in Comment 0, then the steps from Comment 5 are a good next step.


If either of you are still seeing a message that _does_ match up with the text listed under "Results" in Comment 0, then if you would like to attach your diagnostic MSBuild output [1] to this bug report as a new `.txt` or `.zip` file attachment (optionally marked Private so it's only visible to the Xamarin team), that could be a useful extra piece of information for the Xamarin team to have on hand.


[1] http://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Diagnostic_MSBuild_Output

(This document is listed under the Xamarin.Android section of the docs, but the steps are the same for Xamarin.iOS.)



Thanks in advance,
Brendan
Xamarin Customer Support
Comment 10 Alvaro Rivoir 2016-01-30 21:19:40 UTC
I just installed the latest Xamarin.Android version 6.0.1.10 and the same error appears.
Comment 11 me 2017-04-18 20:23:28 UTC
So my testing shows that this problem is correctly being reported as a warning. However, in my company's solution there are 300ish warning of this type reported. This is unacceptable for us as we require warnings to be fixed or suppressed before code is checked in. To my knowledge there is no way to suppress these warnings, is this correct?
Comment 12 Brendan Zagaeski (Xamarin Team, assistant) 2017-04-18 20:43:07 UTC
For recent appearances of symptoms involving *FileListAbsolute.txt, please see recent bug reports that mention FileListAbsolute.txt such as:

- Bug 54966
- Bug 54467

(Example Bugzilla search: https://bugzilla.xamarin.com/buglist.cgi?f1=creation_ts&longdesc=FileListAbsolute.txt&longdesc_type=allwordssubstr&o1=greaterthaneq&product=Visual%20Studio%20Extensions&query_format=advanced&v1=2016-10-01)
Comment 13 me 2017-04-19 12:49:54 UTC
Neither of those bugs are what I'm experiencing. I never had an infinite build problem. I think I'm just seeing the aftermath of this "fixed" bug. From my understanding this bug 36190 was "fixed" by changing these errors to warnings. What I'm asking for is a way to make these warnings disappear. If I turn off parallel builds (which I'm only willing to do temporarily) then I no longer get these warnings which makes me believe that this bug is indeed my problem.
Comment 14 Brendan Zagaeski (Xamarin Team, assistant) 2017-04-19 16:24:37 UTC
This exact bug report can be considered closed at this time since it was inactive for over a year after Comment 9.  If you have a follow-up behavior you'd like to report for a new round of investigation that does not match an existing open bug report, don't hesitate to file a new bug report, being sure to include as many details [1] as possible (ideally including a test case and steps to reproduce).  Thanks in advance!
Comment 15 Brendan Zagaeski (Xamarin Team, assistant) 2017-04-19 16:25:09 UTC
[1] https://developer.xamarin.com/guides/cross-platform/troubleshooting/questions/howto-file-bug/
Comment 16 Ernstjan Freriks 2017-04-24 10:38:09 UTC
@Brendan Zagaeski : In our solution I am working for a month with Visual Studio 2017 / Xamarin and never had issues with these 'hanging' builds. I do had frequently 'hanging' builds in VS2015 however with the same solution. Just recently upgraded VS2017 to 15.1 (26403.7) and Xamarin (4.4.0.34) and now I experience this problem again. Our workaround was to delete the bin/obj folder and rebuild. So maybe this is recently popped up again?

Note You need to log in before you can comment on or make changes to this bug.