Skip to content

Upgrade to .NET 10 and resolve all nullable warnings#6

Open
Aswikinz wants to merge 1 commit intothisismalindu:mainfrom
Aswikinz:main
Open

Upgrade to .NET 10 and resolve all nullable warnings#6
Aswikinz wants to merge 1 commit intothisismalindu:mainfrom
Aswikinz:main

Conversation

@Aswikinz
Copy link
Copy Markdown

Upgrade target framework from net6.0-windows to net10.0-windows and add EnableWindowsTargeting for cross-platform build support.Fixed 20 compiler warnings (0 errors) to achieve a clean build.

Target framework:

  • SymbolPicker.csproj: net6.0-windows → net10.0-windows
  • Add EnableWindowsTargeting property for building on non-Windows hosts

Nullable reference type fixes (CS8618, CS8600, CS8604, CS8625, CS8602):

  • Program.cs: Initialize SettingPage and MainForm with null! suppression since they are assigned in Main() before any access
  • Program.cs: Annotate FindWindow lpClassName parameter as string?
  • Form1.cs: Make CancellationTokenSource field nullable
  • Form1.cs: Replace unsafe (Button)sender cast with pattern match (if sender is not Button senderButton) for null safety
  • Form1.cs: Use Symbol? and Button? for FirstOrDefault() return values
  • Form1.cs: Guard addS?.img dereference with fallback to senderButton.Text
  • Form1.cs: Pass actual sender/e args instead of null literals to textBox_search_Leave from keyboard handlers
  • Form1.cs: Use MouseEventArgs? for the as-cast in tray click handler
  • Settings.cs: Use Dictionary<string, object>? for Deserialize result
  • Settings.cs: Use object? for Convert.ChangeType and GetValue results

Naming (CS8981):

  • Form1.cs: Rename HotKey.control enum to HotKey.HotkeyModifier to avoid lowercase-only type name that may conflict with future C# keywords

Unused code (CS0169):

  • Settings.Designer.cs: Remove unused checkBox2 field

Upgrade target framework from net6.0-windows to net10.0-windows and add EnableWindowsTargeting for cross-platform build support.Fixed 20 compiler warnings (0 errors) to achieve a clean build.

  Target framework:
  - SymbolPicker.csproj: net6.0-windows → net10.0-windows
  - Add EnableWindowsTargeting property for building on non-Windows hosts

  Nullable reference type fixes (CS8618, CS8600, CS8604, CS8625, CS8602):
  - Program.cs: Initialize SettingPage and MainForm with null! suppression
    since they are assigned in Main() before any access
  - Program.cs: Annotate FindWindow lpClassName parameter as string?
  - Form1.cs: Make CancellationTokenSource field nullable
  - Form1.cs: Replace unsafe (Button)sender cast with pattern match
    (if sender is not Button senderButton) for null safety
  - Form1.cs: Use Symbol? and Button? for FirstOrDefault() return values
  - Form1.cs: Guard addS?.img dereference with fallback to senderButton.Text
  - Form1.cs: Pass actual sender/e args instead of null literals to
    textBox_search_Leave from keyboard handlers
  - Form1.cs: Use MouseEventArgs? for the as-cast in tray click handler
  - Settings.cs: Use Dictionary<string, object>? for Deserialize result
  - Settings.cs: Use object? for Convert.ChangeType and GetValue results

  Naming (CS8981):
  - Form1.cs: Rename HotKey.control enum to HotKey.HotkeyModifier to
    avoid lowercase-only type name that may conflict with future C# keywords

  Unused code (CS0169):
  - Settings.Designer.cs: Remove unused checkBox2 field
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.

1 participant