Skip to content

Clarify with initialization order #47977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 18, 2025
Merged

Conversation

BillWagner
Copy link
Member

@BillWagner BillWagner commented Aug 15, 2025

Fixes #47503

In articles where record and with expressions are explained, add details about the order of initialization and with expressions. Provide guidance to compute the property value on access, not initialization.


Internal previews

📄 File 🔗 Preview link
docs/csharp/fundamentals/types/records.md Introduction to record types in C#
docs/csharp/language-reference/builtin-types/record.md Records (C# reference)
docs/csharp/language-reference/operators/with-expression.md The with expression - Nondestructive mutation creates a new object with modified properties

Fixes dotnet#47503

In articles where `record` and `with` expressions are explained, add details about the order of initialization and with expressions. Provide guidance to compute the property value on access, not initialization.
Copy link
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 issues. Other issues are also a high priority. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@BillWagner BillWagner requested a review from adegeo August 15, 2025 19:21
Copy link
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 issues. Other issues are also a high priority. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
@BillWagner BillWagner enabled auto-merge (squash) August 18, 2025 18:05
@BillWagner BillWagner merged commit fe08267 into dotnet:main Aug 18, 2025
8 checks passed
@BillWagner BillWagner deleted the skeet-footgun branch August 18, 2025 18:22
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.

Document the possible footgun for compute-on-initialization properties and the with operator
2 participants