-
-
Notifications
You must be signed in to change notification settings - Fork 198
Double write detection
MSBuildStructuredLogViewer has a rudimentary double-write detection mechanism. A double-write is when during the same build process an output file is written to more than once. Most often this happens when two or more different source files are copied to the same destination location, often in non-deterministic order, overwriting each other. This is bad because it makes the build non-deterministic and causes errors down the line.
Double-writes are also bad for build incrementality. The project that copies the first version of the file sees the second version in the destination, and decides to rebuild to copy what it thinks is the correct version (first) to the destination. Then the second project builds, sees the first version in the destination, thinks this is wrong, and copies the second version back. This way they flip-flop indefinitely causing unnecessary overbuilding.
The way double-write detection works is we search through all Copy tasks and group them by destination. If we detect two or more Copy operations where the destination is the same, we report it as a double-write.
Double-writes are displayed in the log tree view at the end of the log, in a red folder called DoubleWrites.
Warning: double-write detection is not exhaustive since it doesn't catch files written by means other than the Copy task. A more robust way to do it would be using a file-system filter or other low-level mechanism (e.g. what SysInternals ProcMon does). However right now it is not implemented.