Skip to content

Conversation

@HavenDV
Copy link
Owner

@HavenDV HavenDV commented Nov 29, 2025

Added System.Drawing.Common 10.0.0 package reference to all platform projects that compile shared System.Drawing source files. This fixes the IImage type reference error in GeneratedIconSource.System.Drawing.cs for .NET 10 target frameworks.

Projects updated:

  • H.NotifyIcon.Wpf (net10.0-windows)
  • H.NotifyIcon.WinUI (net10.0-windows10.0.17763.0)
  • H.NotifyIcon.Uno (net10.0)
  • H.NotifyIcon.Uno.WinUI (net10.0, net10.0-windows10.0.19041)
  • H.NotifyIcon.Maui (net10.0, net10.0-windows10.0.19041.0)

Resolves: Assembly reference to System.Private.Windows.GdiPlus

Summary by CodeRabbit

  • Chores
    • Added System.Drawing.Common dependency support for .NET 10.0 builds across platform-specific libraries to ensure compatibility with the latest framework version.

✏️ Tip: You can customize this high-level summary in your review settings.

Added System.Drawing.Common 10.0.0 package reference to all platform
projects that compile shared System.Drawing source files. This fixes
the IImage type reference error in GeneratedIconSource.System.Drawing.cs
for .NET 10 target frameworks.

Projects updated:
- H.NotifyIcon.Wpf (net10.0-windows)
- H.NotifyIcon.WinUI (net10.0-windows10.0.17763.0)
- H.NotifyIcon.Uno (net10.0)
- H.NotifyIcon.Uno.WinUI (net10.0, net10.0-windows10.0.19041)
- H.NotifyIcon.Maui (net10.0, net10.0-windows10.0.19041.0)

Resolves: Assembly reference to System.Private.Windows.GdiPlus
@coderabbitai
Copy link

coderabbitai bot commented Nov 29, 2025

Walkthrough

Conditional PackageReference entries for System.Drawing.Common (version 10.0.0) are added to five project files (Maui, Uno.WinUI, Uno, WinUI, and Wpf), each targeting specific .NET 10.0 framework variants without altering functional code or public APIs.

Changes

Cohort / File(s) Change Summary
System.Drawing.Common Dependency Additions
src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj, src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj, src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj, src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj, src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
Conditional PackageReference for System.Drawing.Common v10.0.0 added to each project with framework-specific conditions (net10.0, net10.0-windows variants)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Verify System.Drawing.Common v10.0.0 compatibility with each target framework condition
  • Confirm no version conflicts with existing dependencies across projects

Poem

🐰 A drawing brush we now procure,
For dot-net ten, so fresh and pure!
Each framework gets its rightful share,
Common colors everywhere! 🎨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix missing System.Drawing assembly reference' directly and clearly describes the main change: adding System.Drawing.Common package references to resolve assembly reference errors in .NET 10 target frameworks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/fix-drawing-assembly-ref-01JirDb1pD15DULCmqcfm7WY

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 27507ca and 618f8c6.

📒 Files selected for processing (5)
  • src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj (1 hunks)
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj (1 hunks)
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj (1 hunks)
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj (1 hunks)
  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj (1 hunks)
🧰 Additional context used
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/{H.GeneratedIcons.System.Drawing,H.GeneratedIcons.SkiaSharp}/**/*.cs : When modifying icon generation, update both System.Drawing and SkiaSharp implementations to maintain feature parity
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/H.NotifyIcon.Shared/**/*.{Wpf,WinUI,WinRT}.cs : Use platform-specific filename suffixes .Wpf.cs, .WinUI.cs, .WinRT.cs for platform-specific implementations in the Shared project
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/Directory.Build.props : Configure GraphicsLibrary (System.Drawing or SkiaSharp) in src/libs/Directory.Build.props and map to HAS_SYSTEM_DRAWING or HAS_SKIA_SHARP defines
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/H.NotifyIcon/** : Use CsWin32-generated P/Invoke for Windows interop (Shell_NotifyIcon and NOTIFYICONDATA) instead of handwritten signatures
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/H.NotifyIcon.Shared/**/*.cs : Place cross-platform shared code under src/libs/H.NotifyIcon.Shared/, organized by feature files (e.g., TaskbarIcon.cs, TaskbarIcon.Properties.cs, TaskbarIcon.ContextMenu.cs)
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/{H.NotifyIcon,H.NotifyIcon.Wpf,H.NotifyIcon.WinUI,H.NotifyIcon.Uno.WinUI,H.NotifyIcon.Maui,H.GeneratedIcons.System.Drawing,H.GeneratedIcons.SkiaSharp}/*.csproj : Sign library assemblies with src/libs/key.snk (SignAssembly true and AssemblyOriginatorKeyFile set)
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/apps/**/*.csproj : Sample apps should target the platform-appropriate frameworks listed (e.g., WPF, WinUI, Console, MAUI) and remain buildable via dotnet run/build commands
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/**/*.cs : Use conditional compilation symbols for platform code: HAS_WPF, HAS_WINUI, HAS_UNO, HAS_MAUI; and for graphics backends: HAS_SYSTEM_DRAWING, HAS_SKIA_SHARP
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to tests/H.NotifyIcon.IntegrationTests/*.csproj : Maintain test target frameworks for Windows (e.g., net4.8 and net9.0-windows) in the integration test project
📚 Learning: 2025-10-23T11:04:44.417Z
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to tests/H.NotifyIcon.IntegrationTests/*.csproj : Maintain test target frameworks for Windows (e.g., net4.8 and net9.0-windows) in the integration test project

Applied to files:

  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
  • src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
📚 Learning: 2025-10-23T11:04:44.417Z
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/H.NotifyIcon.Shared/**/*.{Wpf,WinUI,WinRT}.cs : Use platform-specific filename suffixes .Wpf.cs, .WinUI.cs, .WinRT.cs for platform-specific implementations in the Shared project

Applied to files:

  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
  • src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
📚 Learning: 2025-10-23T11:04:44.417Z
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/{H.GeneratedIcons.System.Drawing,H.GeneratedIcons.SkiaSharp}/**/*.cs : When modifying icon generation, update both System.Drawing and SkiaSharp implementations to maintain feature parity

Applied to files:

  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
  • src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
📚 Learning: 2025-10-23T11:04:44.417Z
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/H.NotifyIcon/** : Use CsWin32-generated P/Invoke for Windows interop (Shell_NotifyIcon and NOTIFYICONDATA) instead of handwritten signatures

Applied to files:

  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
  • src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
📚 Learning: 2025-10-23T11:04:44.417Z
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/H.NotifyIcon.Shared/**/*.cs : Place cross-platform shared code under src/libs/H.NotifyIcon.Shared/, organized by feature files (e.g., TaskbarIcon.cs, TaskbarIcon.Properties.cs, TaskbarIcon.ContextMenu.cs)

Applied to files:

  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
  • src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
📚 Learning: 2025-10-23T11:04:44.417Z
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/{H.NotifyIcon,H.NotifyIcon.Wpf,H.NotifyIcon.WinUI,H.NotifyIcon.Uno.WinUI,H.NotifyIcon.Maui,H.GeneratedIcons.System.Drawing,H.GeneratedIcons.SkiaSharp}/*.csproj : Sign library assemblies with src/libs/key.snk (SignAssembly true and AssemblyOriginatorKeyFile set)

Applied to files:

  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
  • src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
📚 Learning: 2025-10-23T11:04:44.417Z
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/H.NotifyIcon.Uno/*.csproj : Do not sign H.NotifyIcon.Uno (set SignAssembly to false)

Applied to files:

  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
  • src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
📚 Learning: 2025-10-23T11:04:44.417Z
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/**/*.cs : Use conditional compilation symbols for platform code: HAS_WPF, HAS_WINUI, HAS_UNO, HAS_MAUI; and for graphics backends: HAS_SYSTEM_DRAWING, HAS_SKIA_SHARP

Applied to files:

  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
  • src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
📚 Learning: 2025-10-23T11:04:44.417Z
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/H.NotifyIcon/**/TaskbarIcon.*.cs : Keep TaskbarIcon split by concern (Properties, ContextMenu, MouseEvents, KeyboardEvents, Notifications, IconSource) rather than monolithic files

Applied to files:

  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
  • src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
📚 Learning: 2025-10-23T11:04:44.417Z
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/H.NotifyIcon.Shared/**/*.{Wpf,WinUI}.cs : For WinUI/Uno context menus, keep implementations under TaskbarIcon.ContextMenu.* partials and adhere to ContextMenuMode behavior contracts

Applied to files:

  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
📚 Learning: 2025-10-23T11:04:44.417Z
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/apps/**/*.csproj : Sample apps should target the platform-appropriate frameworks listed (e.g., WPF, WinUI, Console, MAUI) and remain buildable via dotnet run/build commands

Applied to files:

  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
  • src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
📚 Learning: 2025-10-23T11:04:44.417Z
Learnt from: CR
Repo: HavenDV/H.NotifyIcon PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-23T11:04:44.417Z
Learning: Applies to src/libs/Directory.Build.props : Configure GraphicsLibrary (System.Drawing or SkiaSharp) in src/libs/Directory.Build.props and map to HAS_SYSTEM_DRAWING or HAS_SKIA_SHARP defines

Applied to files:

  • src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj
  • src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj
  • src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj
  • src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj
  • src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build and test PR / Build, test and publish
  • GitHub Check: claude-review
🔇 Additional comments (5)
src/libs/H.NotifyIcon.WinUI/H.NotifyIcon.WinUI.csproj (1)

43-45: Condition correctly targets WinUI's .NET 10 Windows framework.

The ItemGroup condition properly targets net10.0-windows10.0.17763.0, which is the project's TargetFramework. The System.Drawing.Common 10.0.0 reference is appropriately scoped for Windows-only targets.

src/libs/H.NotifyIcon.Uno.WinUI/H.NotifyIcon.Uno.WinUI.csproj (1)

60-62: Condition correctly targets Uno.WinUI's desktop frameworks.

The ItemGroup condition properly targets net10.0 and net10.0-windows10.0.19041, excluding cross-platform Uno targets (android, ios, maccatalyst) which do not require System.Drawing. The scoping is appropriate.

src/libs/H.NotifyIcon.Wpf/H.NotifyIcon.Wpf.csproj (1)

67-69: Condition correctly targets WPF's .NET 10 Windows framework.

The ItemGroup condition properly targets net10.0-windows, isolating the System.Drawing.Common reference to only .NET 10 Windows builds while preserving net4.6.2 unchanged.

src/libs/H.NotifyIcon.Uno/H.NotifyIcon.Uno.csproj (1)

40-42: Condition correctly targets Uno's desktop framework.

The ItemGroup condition properly targets net10.0 (desktop), excluding cross-platform Uno targets (android, ios, maccatalyst) that do not require System.Drawing. The scoping is appropriate.

src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj (1)

60-62: System.Drawing.Common 10.0.0 is available and compatible with .NET 10.

Verification confirms that System.Drawing.Common 10.0.0 is published on NuGet with explicit net10.0 target framework support. The conditional ItemGroup correctly targets net10.0 and net10.0-windows10.0.19041.0, which are the appropriate Windows/desktop variants from the project's TargetFrameworks.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot enabled auto-merge November 29, 2025 17:32
@claude
Copy link

claude bot commented Nov 29, 2025

Pull Request Review

Summary

This PR adds System.Drawing.Common version 10.0.0 as a package reference to all platform-specific projects that compile shared System.Drawing source files for .NET 10 target frameworks. This resolves build issues where System.Drawing types (Icon, Bitmap) were not available.


Positive Findings

1. Problem Identification

  • Correctly identifies that .NET 10 no longer includes System.Drawing types in-box and requires explicit package reference
  • Targets all affected platform projects systematically

2. Consistency

  • Uses appropriate version (10.0.0) matching the .NET 10 target framework
  • Follows the pattern already established in H.GeneratedIcons.System.Drawing project
  • Conditional inclusion ensures the package is only added for affected target frameworks

3. Scope

  • All 5 platform projects that use the shared System.Drawing code are updated

See next comment for issues and recommendations...

@claude
Copy link

claude bot commented Nov 29, 2025

Issues and Concerns (CRITICAL)

1. Incomplete Target Framework Coverage

Several projects target multiple .NET 10 frameworks, but the conditions do not cover all of them. For example, H.NotifyIcon.Uno.WinUI targets:

  • net10.0
  • net10.0-android
  • net10.0-ios
  • net10.0-maccatalyst
  • net10.0-windows10.0.19041

But the condition only covers 2 of 5 frameworks (net10.0 and net10.0-windows10.0.19041).

Missing coverage: net10.0-android, net10.0-ios, net10.0-maccatalyst

The same issue affects H.NotifyIcon.Maui which also targets these mobile frameworks.

Why this matters: The shared GeneratedIconSource.System.Drawing.cs file uses System.Drawing.Icon and System.Drawing.Bitmap types via the global usings when HAS_SYSTEM_DRAWING is defined. These types will be unavailable on mobile target frameworks, causing build failures.

@claude
Copy link

claude bot commented Nov 29, 2025

2. Platform Appropriateness

System.Drawing.Common is not recommended for mobile platforms (Android, iOS, macOS). Microsoft guidance states:

  • System.Drawing.Common is Windows-only starting with .NET 6
  • Cross-platform scenarios should use libraries like SkiaSharp or ImageSharp

Questions to consider:

  • Should the shared System.Drawing code be conditionally compiled only for Windows platforms?
  • Should mobile platforms use the SkiaSharp backend instead (already available in the codebase)?
  • Are the GeneratedIconSource features even used on mobile platforms?

3. Code Observation

Looking at src/libs/H.NotifyIcon.Shared/GeneratedIconSource.System.Drawing.cs, all methods are marked with [SupportedOSPlatform("windows")]. This suggests the System.Drawing code path is Windows-only by design. However, the package reference is being added for all platforms without conditional compilation to prevent System.Drawing code from being included on mobile.

@claude
Copy link

claude bot commented Nov 29, 2025

Recommendations

High Priority:

  1. Verify mobile platform support - Determine if System.Drawing functionality is needed on Android/iOS/macOS

    • If NO: Add conditional compilation to exclude System.Drawing code on mobile platforms
    • If YES: Consider switching mobile platforms to SkiaSharp backend instead
  2. Update conditions to match actual usage - Either:

    • Option A: Restrict package reference to Windows-only TFMs (recommended)
    • Option B: Add missing mobile TFMs to conditions (not recommended due to platform issues)

Medium Priority:
3. Verify build success - Run builds for all target frameworks, especially mobile ones:

  • dotnet build src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj -f net10.0-android
  • dotnet build src/libs/H.NotifyIcon.Maui/H.NotifyIcon.Maui.csproj -f net10.0-ios
  1. Consider consolidation - The pattern repeats across 5 projects - could this be moved to Directory.Build.props with appropriate conditions?

@claude
Copy link

claude bot commented Nov 29, 2025

Summary Assessment

Code Quality: Needs improvement
Approach: Correct direction, incomplete execution
Risk Level: Medium - May cause build failures on untested mobile platforms

The PR correctly identifies the need for explicit System.Drawing.Common references in .NET 10, but does not fully account for multi-platform scenarios where System.Drawing may not be appropriate or supported. Before merging, please verify the behavior on all target frameworks and clarify the intended platform support for the GeneratedIconSource functionality.

Alternative Approach

Consider leveraging the existing GraphicsLibrary infrastructure in Directory.Build.props to add platform-specific conditions that use SkiaSharp on mobile platforms. This would avoid System.Drawing.Common dependency on non-Windows platforms and align with the existing HAS_SYSTEM_DRAWING vs HAS_SKIA_SHARP defines.

@HavenDV HavenDV closed this Nov 29, 2025
auto-merge was automatically disabled November 29, 2025 18:32

Pull request was closed

@michalpaukert
Copy link

@HavenDV why this pull request was closed? I think this could fix #217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants