Contributing to Datadog MAUI SDK
Thank you for your interest in contributing to the Datadog SDK for .NET MAUI!
Development Setup
Prerequisites
- .NET 8+ SDK
- macOS with Xcode 14+ (for iOS development)
- Android SDK API Level 34+
- Git
Getting Started
- Clone the repository
git clone https://github.com/DataDog/dd-sdk-maui.git
cd dd-sdk-maui
- Download native frameworks
# Download iOS XCFrameworks
./scripts/download-ios-frameworks.sh
# (Optional) Check Android dependencies
./scripts/update-android-dependencies.ps1 -Version 3.5.0 -OutputFile deps.json
- Build the project
./scripts/build.sh Debug
Project Structure
dd-sdk-maui/
├── Datadog.MAUI.iOS.Binding/ # iOS native binding
│ ├── *.xcframework/ # XCFrameworks (git-ignored)
│ ├── ApiDefinition.cs # Objective-C API definitions
│ └── StructsAndEnums.cs # Enums and structs
├── Datadog.MAUI.Android.Binding/ # Android native binding
│ ├── Additions/ # Custom C# code
│ └── Transforms/Metadata.xml # Binding metadata
├── Datadog.MAUI.Plugin/ # Main cross-platform API
│ ├── Shared/ # Shared interfaces
│ └── Platforms/ # Platform implementations
├── samples/DatadogMauiSample/ # Sample application
└── scripts/ # Build and utility scripts
Making Changes
Binding Changes
iOS Binding
The iOS binding uses Objective-C bindings generated from XCFrameworks:
- Download the XCFrameworks:
./scripts/download-ios-frameworks.sh - Generate bindings using Objective Sharpie (optional):
sharpie bind --output=Generated --namespace=DatadogMaui.iOS \ --sdk=iphoneos17.0 \ DatadogCore.xcframework/ios-arm64/DatadogCore.framework/Headers/*.h - Update ApiDefinition.cs with the generated bindings
- Update StructsAndEnums.cs if needed
Android Binding
The Android binding uses AndroidMavenLibrary references:
- Update Datadog.MAUI.Android.Binding.csproj with Maven dependencies
- If binding errors occur, fix them in Transforms/Metadata.xml
- Add custom code in Additions/ if needed
API Changes
When adding or modifying the public API:
- Update interfaces in Datadog.MAUI.Plugin/Shared/
- Implement for both platforms:
- Update Documentation Index with usage examples
- Add tests if applicable
Testing
Local Testing
- Build the packages:
./scripts/build.sh Release - Reference the local packages in your test project:
<ItemGroup> <PackageReference Include="Datadog.MAUI" Version="3.5.0"> <Source>./path/to/dd-sdk-maui/artifacts/packages</Source> </PackageReference> </ItemGroup> - Test on iOS and Android devices/simulators
Sample Application
The samples/DatadogMauiSample project can be used for testing:
- Add your Datadog credentials to MauiProgram.cs
- Run on iOS:
dotnet build -f net9.0-ios && open -a Simulator - Run on Android:
dotnet build -f net9.0-android
Version Management
Updating SDK Version
The Datadog SDK version is managed in Directory.Build.props:
<DatadogSdkVersion>3.5.0</DatadogSdkVersion>
When updating to a new Datadog SDK version:
- Update
DatadogSdkVersionin Directory.Build.props - Download new iOS frameworks:
./scripts/download-ios-frameworks.sh NEW_VERSION - Update Android dependencies if needed
- Update CHANGELOG.md
- Test thoroughly on both platforms
Code Style
- Follow C# coding conventions
- Use meaningful variable and method names
- Add XML documentation comments for public APIs
- Keep platform-specific code in Platform folders
Pull Request Process
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes
- Commit with clear messages:
git commit -m "Add: description of changes" - Push to your fork:
git push origin feature/my-feature - Create a Pull Request
PR Checklist
- Code builds without errors
- Tests pass (if applicable)
- Documentation updated
- CHANGELOG.md updated
- Follows code style guidelines
- No breaking changes (or documented if necessary)
Troubleshooting
iOS Build Fails
- Ensure XCFrameworks are downloaded:
ls Datadog.MAUI.iOS.Binding/*.xcframework - Check Xcode version:
xcodebuild -version - Clean and rebuild:
dotnet clean && ./scripts/build.sh
Android Build Fails
- Check Maven dependencies are accessible
- Review binding errors in build output
- Fix metadata in
Transforms/Metadata.xml
Binding Generation Issues
- Use Objective Sharpie for iOS:
brew install sharpie - Review generated code before committing
- Test bindings with simple method calls first
Resources
- .NET MAUI Documentation
- Datadog Documentation
- Native Library Interop
- Xamarin iOS Binding
- Xamarin Android Binding
Questions?
- Open an issue for bugs or feature requests
- Check existing issues before creating new ones
- Be respectful and constructive in discussions
Thank you for contributing!