Skip to content

Bug fixes and add ci build#2319

Open
XUANJI233 wants to merge 3 commits into
d2phap:v10from
XUANJI233:v10
Open

Bug fixes and add ci build#2319
XUANJI233 wants to merge 3 commits into
d2phap:v10from
XUANJI233:v10

Conversation

@XUANJI233
Copy link
Copy Markdown

🟢 Summary

Bug fixes

  • Web2.cs: Add fallback to system WebView2 when local WebView2_Runtime folder exists but has no valid runtime
  • Config.cs: Use ConcurrentBag instead of List in Parallel.ForEach for thread-safety
  • FrmMain.IGMethods.cs: Show warning dialog when WebView2 is not installed; replace Parallel.ForEach+Remove with LINQ Where for clipboard thread-safety
  • IgLang.cs: Preserve requested language file name even when the file does not exist on disk

CI

  • Add GitHub Actions CI workflow for Windows x64 builds

🟢 Contributor License Agreement (CLA)

By submitting this pull request, I confirm that:

OpenClaw Bot added 3 commits April 29, 2026 01:14
Bug 1 - IgLang constructor loses requested filename:
- When language file does not exist on disk, FilePath stays 'English'
- FileName returns 'English' instead of the originally requested filename
- Config.WriteAsync() then overwrites igconfig.json with 'English'
- Fix: store _requestedFileName, FileName returns it regardless of file existence

Bug 2 - WebView2 detection never falls back to system runtime:
- If WebView2_Runtime/ folder exists (even empty), GetAvailableBrowserVersionString
  only checks that folder, never the system-installed WebView2
- Fix: catch local failure then retry with null (system-wide lookup)

Bug 3 - Settings opens json silently when WebView2 missing:
- No user feedback when WebView2 is not found
- Fix: show warning dialog before falling back to igconfig.json
- Windows runner with .NET 10 + MSBuild
- Node.js 20 setup with npm cache
- WebUI frontend build (npm ci + npm run build)
- Build artifact upload
1. EnsureWeb2Async: add fallback to system WebView2 when local
   WebView2_Runtime folder exists but has no valid runtime
2. LoadThemeList: use ConcurrentBag instead of List in Parallel.ForEach
3. Clipboard cut: replace Parallel.ForEach+Remove with LINQ Where
Copilot AI review requested due to automatic review settings April 28, 2026 20:46
@XUANJI233 XUANJI233 changed the title V10 Bug fixes and add ci build Apr 28, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets v10 stability by improving WebView2 runtime detection/initialization, addressing thread-safety issues in a few parallel/clipboard paths, and adding a Windows x64 CI build workflow.

Changes:

  • Add user-facing warning when WebView2 is missing before opening settings, and make clipboard “cut multiple files” cleanup safe via LINQ filtering.
  • Fix WebView2 fixed-runtime fallback behavior and make theme loading thread-safe in Parallel.ForEach.
  • Preserve the originally requested language file name, and introduce a Windows CI workflow to build artifacts.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Source/ImageGlass/FrmMain/FrmMain.IGMethods.cs Warn when WebView2 isn’t installed before opening config; make clipboard list cleanup safe.
Source/Components/ImageGlass.Settings/Config.cs Replace non-thread-safe List usage with ConcurrentBag in parallel theme loading.
Source/Components/ImageGlass.Base/Webview2/Web2.cs Add fallback to system WebView2 runtime when local fixed runtime is invalid/missing.
Source/Components/ImageGlass.Base/Language/IgLang.cs Track requested language file name so config can round-trip even if file is missing.
.github/workflows/build.yml Add Windows build workflow producing Release x64 artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 168 to 173

// Always preserve the original requested file name so that
// FileName returns the correct value when saving config.
_requestedFileName = fileName;

if (File.Exists(filePath))
/// Example: <c>Vietnameses.iglang.json</c>
/// </summary>
public string FileName => Path.GetFileName(FilePath);
public string FileName => _requestedFileName ?? Path.GetFileName(FilePath);
Comment on lines +359 to +363
catch
{
// Fall back to the system-installed WebView2 Runtime
if (WebView2RuntimeFixedVersionDirPath != null)
{
Comment on lines +110 to +123
// First try the local fixed-version runtime (WebView2_Runtime folder)
try
{
var version = CoreWebView2Environment.GetAvailableBrowserVersionString(WebView2RuntimeFixedVersionDirPath);
return new Version(version);
}
catch (WebView2RuntimeNotFoundException) { }

// Fall back to the system-installed WebView2 Runtime
if (WebView2RuntimeFixedVersionDirPath != null)
{
try
{
var version = CoreWebView2Environment.GetAvailableBrowserVersionString();
@d2phap
Copy link
Copy Markdown
Owner

d2phap commented May 10, 2026

Hi @XUANJI233
I see you're targeting v10 branch but your improvement is actually on v9 source code. I suggest to use develop branch as the base instead

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.

3 participants