Skip to content

Add NOTE callout about DateTime calculation limitations in default interface methods tutorial #47311

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 2 commits into from
Jul 15, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 14, 2025

Addresses feedback about DateTime calculation edge cases in the default interface methods tutorial sample code. The tutorial contains DateTime.Now.AddYears(-2) which can have issues with daylight saving time transitions and leap years.

Following maintainer guidance, this change adds a NOTE callout to acknowledge these limitations while keeping the sample code simple and focused on demonstrating default interface methods functionality.

Changes:

  • Added NOTE callout after the code snippet explaining DateTime calculation edge cases
  • Provides guidance for production code to use UTC time or more robust approaches
  • Maintains tutorial simplicity while educating readers about DateTime limitations

The NOTE appears right after the first code example to ensure readers are aware of the considerations before seeing the implementation.

Fixes #26723.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Internal previews

📄 File 🔗 Preview link
docs/csharp/advanced-topics/interface-implementation/default-interface-methods-versions.md docs/csharp/advanced-topics/interface-implementation/default-interface-methods-versions

@dotnet-policy-service dotnet-policy-service bot added the okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. label Jul 14, 2025
Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Bug in sample code. Add NOTE callout about DateTime calculation limitations in default interface methods tutorial Jul 14, 2025
@Copilot Copilot AI requested a review from BillWagner July 14, 2025 19:41
Copilot finished work on behalf of BillWagner July 14, 2025 19:41
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM.

I'll mark it ready for final review.

@BillWagner BillWagner marked this pull request as ready for review July 15, 2025 14:43
@BillWagner BillWagner requested a review from a team as a code owner July 15, 2025 14:43
@BillWagner BillWagner requested a review from IEvangelist July 15, 2025 14:43
@IEvangelist IEvangelist merged commit 7411ad9 into main Jul 15, 2025
13 checks passed
@IEvangelist IEvangelist deleted the copilot/fix-26723 branch July 15, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet-csharp/svc okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in sample code.
3 participants