Skip to content

Propose ADR for using TryAdd in .NET dependency injection #606

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

justindbaur
Copy link
Member

🎟️ Tracking

N/A

📔 Objective

Add ADR for encouraging use of TryAdd overloads in .NET dependency injection.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation
    team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed
    issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@justindbaur justindbaur requested review from a team as code owners May 31, 2025 11:08
@github-actions github-actions bot added the adr label May 31, 2025
@@ -94,7 +94,7 @@ It may sometimes be needed to assert to the compiler that you know something is
it thinks it might be - to do that you can use the [`!` operator][null-forgiving]. You may want to
do this for properties that you know are populated elsewhere; for example:

```c#
```csharp
Copy link
Member Author

@justindbaur justindbaur May 31, 2025

Choose a reason for hiding this comment

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

When writing this ADR I realized c# doesn't make syntax highlighting work in our docs only csharp. Even though c# does work in GitHub.

Copy link

cloudflare-workers-and-pages bot commented May 31, 2025

Deploying contributing-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8909941
Status: ✅  Deploy successful!
Preview URL: https://a7de5539.contributing-docs.pages.dev
Branch Preview URL: https://adr-try-add-dependency-injec.contributing-docs.pages.dev

View logs

@justindbaur justindbaur changed the title Adr try add dependency injection Propose ADR for using TryAdd in .NET dependency injection May 31, 2025
Copy link

github-actions bot commented May 31, 2025

Logo
Checkmarx One – Scan Summary & Detailsa22764b5-be9e-4d6a-a01d-7190570c1402

Great job, no security vulnerabilities found in this Pull Request

occasionally throughout the codebase but they is no outside encouragement to use them.
- **Encourage usage** - Start encouraging usage through team training and encouragement to use them
in code reviews but don't make any automatic check to enforce usage.
- **Enforce usage** - Start enforcing usage of `TryAdd` overloads by adding the
Copy link
Contributor

Choose a reason for hiding this comment

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

💭 My one non-suggestion comment: what if we went this way? Do we get other benefits long-term? The plan here could be two-stage and we introduce this later.

justindbaur and others added 2 commits June 6, 2025 12:50
Co-authored-by: Matt Bishop <matt@withinfocus.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants