Thank you for your interest in contributing! This guide provides a quick overview. For detailed technical conventions and project context, see .github/copilot-instructions.md.
- Fork and clone the repository
- Read the instructions:
.github/copilot-instructions.mdcovers code organization, conventions, and build commands - Build locally:
dotnet restore ./src/Mammoth.Extensions.DependencyInjection.sln dotnet build ./src/Mammoth.Extensions.DependencyInjection.sln dotnet test ./src/Mammoth.Extensions.DependencyInjection.sln
- Create a branch for your feature or fix
- Make your changes (see sections below)
- Run tests and ensure all pass
- Open a Pull Request
src/Mammoth.Extensions.DependencyInjection/— Main library (extension methods, decorators, keyed services)src/Mammoth.Extensions.DependencyInjection.Tests/— Unit tests (MSTest + coverlet)src/Directory.Build.props— Shared build configuration (frameworks, C# version, analyzers)Changelog.md— Release notes and breaking changes.github/copilot-instructions.md— Full technical context for development
- Add to the appropriate partial class:
ServiceCollectionExtensions.*.csfor service registrationServiceProviderExtensions.*.csfor provider queries/operations
- Include XML documentation (
///) with examples for all public methods - Follow fluent API pattern (return
IServiceCollectionfor chaining where applicable) - Add corresponding tests in
*.Tests.csmatching your source file name
- Refer to
ServiceCollectionExtensions.Decorators.csandServiceCollectionExtensions.KeyedService.cs - Ensure compatibility with transient, scoped, singleton, and factory registrations
- Target the library for
netstandard2.0; run tests onnet472,net8.0,net9.0,net10.0 - Use
ServiceIdentifierto track keyed services uniquely
- Some features may not work on all frameworks (e.g., reflection features on
netstandard2.0) - Use
.Disabled.csfile pattern for conditional compilation (seeServiceProviderExtensions.Reflection.Disabled.cs) - Verify
Directory.Build.propstarget framework constraints
- C# 14.0 with nullable reference types enabled
- Named parameters: Use explicit parameter names in calls
- Nullability: Strict checking; mark nullable types with
? - Analyzers: Latest recommended rules enforced at build time
- Tests: Use
[TestMethod]/[TestClass](MSTest); leverageTestServices.csfor fixtures
- Run all tests:
dotnet test ./src/Mammoth.Extensions.DependencyInjection.sln - Run specific test class:
dotnet test --filter ClassName=MyTestsClass - With coverage:
dotnet test --collect:"XPlat Code Coverage" - Test files follow naming:
ServiceCollectionExtensions.Decorators.Tests.csmatchesServiceCollectionExtensions.Decorators.cs
Every feature or fix should update Changelog.md:
- Find the
## vNextsection at the top - Add a bullet point describing your change:
## vNext - Added support for wrapping async factory registrations [#XX](https://github.com/PrimordialCode/Mammoth.Extensions.DependencyInjection/issues/XX).
- Reference the issue number if applicable
- If a breaking change, prefix with "### Breaking Changes" section
- Code builds without warnings (
dotnet build --configuration Release) - All tests pass (
dotnet test) - New public APIs have XML documentation
- Changelog updated in
vNextsection - Changes verified across target frameworks (at least build the library for
netstandard2.0and run tests onnet472/net8.0+) - No transient disposables in new code (use
DetectIncorrectUsageOfTransientDisposablesdiagnostic)
If you need guidance on architecture, decorators, keyed services, or multi-framework compatibility:
- Check
.github/copilot-instructions.mdfor detailed patterns - Review existing code in similar feature areas
- Open a discussion issue if you have design questions
By contributing, you agree your work will be licensed under the MIT License (see LICENSE file).
Questions? See the GitHub repository or open an issue.