Skip to content

Repo sync for protected branch#11339

Merged
learn-build-service-prod[bot] merged 43 commits into
mainfrom
main639142206501950035sync_temp
May 12, 2026
Merged

Repo sync for protected branch#11339
learn-build-service-prod[bot] merged 43 commits into
mainfrom
main639142206501950035sync_temp

Conversation

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build Service tried pushing to main, but failed due to branch protection rule in this branch. We create this pull request for manual merge. Please merge this pull request to complete this sync.
If you want to make push successfully without creating such pull requests in future, please follow working with branch protection rule to update your branch protection rule.

ghogen and others added 30 commits September 26, 2025 11:53
Add code examples, fix API names, fill empty sections, and improve
Learn formatting for the MSBuild multithreaded task migration how-to.

- Fix API names to match spec (IMultiThreadableTask, etc.)
- Add BuildCommentTask as running before/after example
- Document AbsolutePath type and API replacement table
- Fill 'Apply the attribute' section with two-option guidance
- Add CLI-only caveat, Roslyn analyzer tip, thread-safety warnings
- Expand backward compatibility section with 3 options + comparison
- Add article to TOC under Tasks
- Update frontmatter for SEO

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add DISABLE_BUILD_COMMENTS env var check to the running example
so the environment variables section uses a concrete before/after
pattern from the same task instead of generic placeholders.

- Insert env var check in both before and after full listings
- Replace MY_VAR/BUILD_OUTPUT with DISABLE_BUILD_COMMENTS in section
- Update issue count (3→4) and migration step count (4→5)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The static ModifiedFileCount with Interlocked.Increment is already
thread-safe. Changing to an instance field would alter the behavior.
Instead, keep the original pattern and add a note about limitations
when multiple builds share the same process.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Change the original BuildCommentTask to use non-atomic ModifiedFileCount++
so the before/after contrast clearly illustrates the problem and fix:
- Before: ModifiedFileCount++ (race condition)
- After: Interlocked.Increment (atomic, thread-safe)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Present static field migration as a progression:
1. Naive ++ (race condition)
2. Interlocked.Increment (atomic, but shared across builds)
3. RegisterTaskObject with Build lifetime (correct per-build isolation)

Explains that in multithreaded mode, multiple builds can share a
process, so static fields leak across build invocations. Uses
IBuildEngine4.RegisterTaskObject to scope shared state to one build.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Static fields already persisted across builds with node reuse (the
default) before multithreading was introduced. The article now
explains both dimensions: persistence (old problem, made worse) and
concurrency (new problem from multithreading).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Changed 'source files' to 'text files' and explained that
CommentPrefix/CommentSuffix adapt the comment syntax to the file type.
Added MSBuild project file snippet showing usage with @(Compile) and
@(Content) item groups. Added code comments to all listings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The normal case for BuildCommentTask is generated or auxiliary text
files, not source files. Default to plain text with no comment prefix;
callers provide CommentPrefix/CommentSuffix when targeting files with
comment syntax (C#, XML, Python, etc.). Updated all three code listings
and MSBuild usage snippet.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The multithreaded task execution model requires MSBuild 18.4, not 18.0
as previously stated. Updated all references throughout the article.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- update-task-multithreaded.md: Added -mt mention in intro paragraph
  and expanded Prerequisites with dotnet build -mt example and link
- msbuild-command-line-reference.md: Duplicated switches table into
  vs-2022 and visualstudio moniker blocks; added -multiThreaded/-mt
  entry to the visualstudio table only

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Callers are responsible for passing only text files and setting
the appropriate CommentPrefix/CommentSuffix for the file type.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
New subsection under 'Update paths and file I/O' covering:
- Why file contention occurs in multithreaded mode
- FileStream with explicit locking (FileShare.None)
- Guidelines: retry on IOException, avoid multi-file locks,
  lock in consistent order, keep locks short

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Point readers to FileStream, FileShare, and managed threading
best practices docs for general guidance beyond the MSBuild example.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Downgraded from WARNING to NOTE, explained that this only applies
to tasks that spawn their own threads (Parallel.ForEach, Task.Run),
not to normal tasks that let MSBuild handle parallelism.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: AR-May <67507805+AR-May@users.noreply.github.com>
Co-authored-by: Rainer Sigwald <raines@microsoft.com>
@learn-build-service-prod
Copy link
Copy Markdown
Contributor Author

Learn Build status updates of commit 3638fe6:

✅ Validation status: passed

For more details, please refer to the build report.

@learn-build-service-prod learn-build-service-prod Bot merged commit 96ea7f5 into main May 12, 2026
5 checks passed
@learn-build-service-prod learn-build-service-prod Bot deleted the main639142206501950035sync_temp branch May 12, 2026 22:11
@prmerger-automator
Copy link
Copy Markdown
Contributor

PRMerger Results

Issue Description
Added File(s) This PR contains added files. New files require human review.
Yaml File(s) This PR includes changes to .yml file(s) owned by another author.
Commits Count This PR contains more than 15 commits.
File Change Percent This PR contains file(s) with more than 30% file change.
Image File This PR added or updated an image file(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants