-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Area: Task: GenerateResourceProblems with the task itself, resgen.exe, and resx resources in general.Problems with the task itself, resgen.exe, and resx resources in general.bugtriaged
Milestone
Description
We have periodically seen this failure in our own build:
src\Tasks\system.design\system.design.txt(0,0): error MSB3103: Invalid Resx file. The process cannot access the file 'D:\a\1\s\src\Tasks\system.design\system.design.txt' because it is being used by another process.
Today I looked into it. I suspect this flow of things:
msbuild/src/Tasks/GenerateResource.cs
Lines 3561 to 3565 in 797fd82
| private void ReadTextResources(ReaderInfo reader, String fileName) | |
| { | |
| // Check for byte order marks in the beginning of the input file, but | |
| // default to UTF-8. | |
| using (LineNumberStreamReader sr = new LineNumberStreamReader(fileName, new UTF8Encoding(true), true)) |
msbuild/src/Tasks/GenerateResource.cs
Lines 3876 to 3877 in 797fd82
| internal LineNumberStreamReader(String fileName, Encoding encoding, bool detectEncoding) | |
| : base(File.Open(fileName, FileMode.Open, FileAccess.Read), encoding, detectEncoding) |
File.Open does not specify FileShare.Read, which defaults to "no sharing". So if this is run on the same file in parallel (for instance, in our Tasks project which is multitargeted), there's a possibility that the second attempt to read the file fails because the first one is still holding a lock.
Metadata
Metadata
Assignees
Labels
Area: Task: GenerateResourceProblems with the task itself, resgen.exe, and resx resources in general.Problems with the task itself, resgen.exe, and resx resources in general.bugtriaged