From 4f74c398599e3e2ce651c48859094d88bcb65c03 Mon Sep 17 00:00:00 2001 From: Aswikinz Date: Fri, 13 Feb 2026 13:07:22 +0530 Subject: [PATCH] Upgrade to .NET 10 and resolve all nullable warnings 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. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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? 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 --- SymbolPicker/Form1.cs | 68 ++-- SymbolPicker/Program.cs | 8 +- SymbolPicker/Settings.Designer.cs | 1 - SymbolPicker/Settings.cs | 6 +- SymbolPicker/SymbolPicker.csproj | 3 +- .../obj/SymbolPicker.csproj.nuget.dgspec.json | 333 +++++++++++++++-- .../obj/SymbolPicker.csproj.nuget.g.props | 9 +- SymbolPicker/obj/project.assets.json | 336 ++++++++++++++++-- SymbolPicker/obj/project.nuget.cache | 8 +- 9 files changed, 676 insertions(+), 96 deletions(-) diff --git a/SymbolPicker/Form1.cs b/SymbolPicker/Form1.cs index ee7bb49..b2528e9 100644 --- a/SymbolPicker/Form1.cs +++ b/SymbolPicker/Form1.cs @@ -38,7 +38,7 @@ private void TestInit() //Console.WriteLine("Oh wait, Im idiot im on release mode"); - //Trace.WriteLine(KeyboardSimulator.SimulateKeyboard(0, KeyEventFlags.UNICODE, 'ÎÒ', true, 0)); + //Trace.WriteLine(KeyboardSimulator.SimulateKeyboard(0, KeyEventFlags.UNICODE, '��', true, 0)); //Trace.WriteLine(KeyboardSimulator.SimulateKeyboard(0, KeyEventFlags.KEYUP)); } @@ -75,7 +75,7 @@ private void Form1_Load(object sender, EventArgs e) if (char.IsLetterOrDigit(Program.SettingPage.textBox_hotkey.Text[0])) { showHideHotKey = (Keys)Enum.Parse(typeof(Keys), Program.SettingPage.textBox_hotkey.Text.ToUpper()); - if (!HotKey.API_RegisterHotKey(this.Handle, SHOWHIDEHOTKEYCODE, HotKey.control.Ctrl, showHideHotKey)) + if (!HotKey.API_RegisterHotKey(this.Handle, SHOWHIDEHOTKEYCODE, HotKey.HotkeyModifier.Ctrl, showHideHotKey)) { MessageBox.Show("Can not reg hot key!"); } @@ -112,7 +112,7 @@ private Button CreateOneButton(string tag, string txt) } private void LoadButtons(string path, List lssym, List