Skip to content

Latest commit

 

History

History
132 lines (95 loc) · 5.1 KB

File metadata and controls

132 lines (95 loc) · 5.1 KB

Contributing to SkiaSharp

Thank you for your interest in contributing to SkiaSharp! This document provides guidelines for submitting issues and pull requests.

📖 Documentation

Before contributing, please review:

🐛 Reporting Issues

If you think you've found a bug, please check the Issues page first to see if an issue has already been filed. This helps reduce duplicate reports.

Before Submitting

  1. Validate that the issue is not resolved with the latest stable, pre-release, or nightly builds
  2. Create a minimal reproduction project using only the code necessary to reproduce the issue
  3. Clean your solution before compressing:
    • Delete all bin/ and obj/ folders
    • Remove the packages/ folder
    • Example structure to clean:
      [ProjectRoot]/ProjectName/bin
      [ProjectRoot]/ProjectName/obj
      [ProjectRoot]/ProjectName.Android/bin
      [ProjectRoot]/ProjectName.Android/obj
      [ProjectRoot]/ProjectName.iOS/bin
      [ProjectRoot]/ProjectName.iOS/obj
      [ProjectRoot]/ProjectName.UWP/bin
      [ProjectRoot]/ProjectName.UWP/obj
      

When Submitting Issues

  • Platform information: Note if the issue occurs only on specific platforms
  • Regressions: If applicable, identify the last working build version
  • Device specifics: Some issues occur only on specific:
    • Device types (phones, tablets, desktops)
    • OS versions
    • Target SDK versions
    • Physical devices vs simulators/emulators
  • Upload reproductions: Attach reproduction projects directly to the issue (don't use external file sharing)

🔧 Contributing Code

We greatly welcome PRs with fixes and improvements from the community!

Pull Request Guidelines

  1. Follow existing patterns - Study similar APIs before adding new ones
  2. Add tests - All new features and bug fixes should include tests
  3. Update documentation - If you're changing public APIs
  4. Memory management - Ensure proper disposal and pointer type handling (see documentation/dev/memory-management.md)
  5. Error handling - Validate parameters and handle errors appropriately (see documentation/dev/error-handling.md)

Adding New APIs

Follow the comprehensive guide in documentation/dev/adding-apis.md, which covers:

  • Analyzing C++ APIs and identifying pointer types
  • Creating C API wrappers
  • Writing P/Invoke declarations
  • Implementing C# wrapper classes
  • Testing your changes

Code Standards

  • Dispose pattern: Always use using statements in samples and tests
  • Parameter validation: Validate all parameters in C# before P/Invoke
  • Error checking: Check return values from C API calls
  • Memory safety: Understand pointer types (see documentation/dev/memory-management.md)
  • Naming conventions: Follow existing naming patterns (see documentation/dev/architecture.md)

🏗️ Building SkiaSharp

Prerequisites

  • .NET 8 SDK - The repo is pinned via global.json
  • MAUI workload - Required for mobile targets:
    dotnet workload install maui

Quick Build (Managed Only)

If you're only making changes to managed code:

# Download pre-built native libraries
dotnet cake --target=externals-download

# Build managed libraries
dotnet cake --target=libs

# Run tests
dotnet cake --target=tests

Quick Validation (Console Tests)

For faster iteration when working on binding code:

dotnet build tests/SkiaSharp.Tests.Console/SkiaSharp.Tests.Console.csproj
dotnet test tests/SkiaSharp.Tests.Console/SkiaSharp.Tests.Console.csproj

See documentation/dev/building.md for complete build instructions.

Full Build (Including Native)

For native code changes, see:

📚 Additional Resources

💡 Questions?

🙏 Thank You!

Your contributions make SkiaSharp better for everyone. We appreciate your time and effort!