fix: try more options when failed to use netfx when import clr#1791
Merged
r0x0r merged 1 commit intor0x0r:masterfrom Mar 18, 2026
Merged
fix: try more options when failed to use netfx when import clr#1791r0x0r merged 1 commit intor0x0r:masterfrom
r0x0r merged 1 commit intor0x0r:masterfrom
Conversation
smparkes
added a commit
to smparkes/pywebview
that referenced
this pull request
Mar 30, 2026
pywebview fails to load on Windows ARM64 because pythonnet's .NET Framework (netfx) runtime is not available on ARM64 — the clr-loader dependency chain (NXPorts → dnlib) does not support ARM64: pythonnet/pythonnet#2523 The upstream fallback in r0x0r#1791 successfully switches to coreclr when netfx is unavailable, but pywebview then fails because several components assume .NET Framework. Use FolderBrowserDialog for the folder picker on coreclr, since the internal FileDialogNative types (IFileDialog, FOS_PICKFOLDERS) used by the existing OpenFolderDialog don't exist in .NET 8. On .NET Framework, the existing FileDialogNative reflection code is preserved unchanged, including its support for multiple folder selection. FolderBrowserDialog does not support multi-select; this limitation only affects coreclr users. (.NET 9 adds FolderBrowserDialog.Multiselect which could be used in a future update.) Update bundled WebView2 interop DLLs from Microsoft.Web.WebView2 NuGet package 1.0.2957.106 to 1.0.3240.44 (netcoreapp3.0 target): https://www.nuget.org/packages/Microsoft.Web.WebView2/1.0.3240.44 The old DLLs referenced System.Windows.Forms.ContextMenu, which was removed in .NET 6+: https://learn.microsoft.com/en-us/dotnet/core/compatibility/windows-forms/6.0/apis-throw-argumentnullexception The new DLLs use ContextMenuStrip instead, which exists on both .NET Framework and .NET 8, so this change is safe for all platforms. Skip the .NET Framework registry check in _is_chromium() when running on coreclr, since coreclr does not register in the .NET Framework registry (HKLM\...\NDP\v4\Full). Also fix a potential UnboundLocalError by initializing net_key before the try block and guarding CloseKey. Add explicit clr.AddReference('Microsoft.Win32.SystemEvents') when PYTHONNET_RUNTIME=coreclr. This assembly is auto-loaded on .NET Framework but requires an explicit reference on coreclr. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
smparkes
added a commit
to smparkes/pywebview
that referenced
this pull request
Mar 30, 2026
pywebview fails to load on Windows ARM64 because pythonnet's .NET Framework (netfx) runtime is not available on ARM64 — the clr-loader dependency chain (NXPorts → dnlib) does not support ARM64: pythonnet/pythonnet#2523 The upstream fallback in r0x0r#1791 successfully switches to coreclr when netfx is unavailable, but pywebview then fails because several components assume .NET Framework. Use FolderBrowserDialog for the folder picker on coreclr, since the internal FileDialogNative types (IFileDialog, FOS_PICKFOLDERS) used by the existing OpenFolderDialog don't exist in .NET 8. On .NET Framework, the existing FileDialogNative reflection code is preserved unchanged, including its support for multiple folder selection. FolderBrowserDialog does not support multi-select; this limitation only affects coreclr users. (.NET 9 adds FolderBrowserDialog.Multiselect which could be used in a future update.) Update bundled WebView2 interop DLLs from Microsoft.Web.WebView2 NuGet package 1.0.2957.106 to 1.0.3240.44 (netcoreapp3.0 target): https://www.nuget.org/packages/Microsoft.Web.WebView2/1.0.3240.44 The old DLLs referenced System.Windows.Forms.ContextMenu, which was removed in .NET 6+: https://learn.microsoft.com/en-us/dotnet/core/compatibility/windows-forms/6.0/apis-throw-argumentnullexception The new DLLs use ContextMenuStrip instead, which exists on both .NET Framework and .NET 8, so this change is safe for all platforms. Skip the .NET Framework registry check in _is_chromium() when running on coreclr, since coreclr does not register in the .NET Framework registry (HKLM\...\NDP\v4\Full). Also fix a potential UnboundLocalError by initializing net_key before the try block and guarding CloseKey. Add explicit clr.AddReference('Microsoft.Win32.SystemEvents') when PYTHONNET_RUNTIME=coreclr. This assembly is auto-loaded on .NET Framework but requires an explicit reference on coreclr. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
smparkes
added a commit
to smparkes/pywebview
that referenced
this pull request
Mar 30, 2026
pywebview fails to load on Windows ARM64 because pythonnet's .NET Framework (netfx) runtime is not available on ARM64 — the clr-loader dependency chain (NXPorts → dnlib) does not support ARM64: pythonnet/pythonnet#2523 The upstream fallback in r0x0r#1791 successfully switches to coreclr when netfx is unavailable, but pywebview then fails because several components assume .NET Framework. Use FolderBrowserDialog for the folder picker on coreclr, since the internal FileDialogNative types (IFileDialog, FOS_PICKFOLDERS) used by the existing OpenFolderDialog don't exist in .NET 8. On .NET Framework, the existing FileDialogNative reflection code is preserved unchanged, including its support for multiple folder selection. FolderBrowserDialog does not support multi-select; this limitation only affects coreclr users. (.NET 9 adds FolderBrowserDialog.Multiselect which could be used in a future update.) The netfx code is wrapped in an if/else on PYTHONNET_RUNTIME, which adds indentation; ignoring whitespace (https://github.com/r0x0r/pywebview/compare/master...smparkes:fix/dotnet8-coreclr?expand=1&w=1) makes the diff much simpler to review. Update bundled WebView2 interop DLLs from Microsoft.Web.WebView2 NuGet package 1.0.2957.106 to 1.0.3240.44 (netcoreapp3.0 target): https://www.nuget.org/packages/Microsoft.Web.WebView2/1.0.3240.44 The old DLLs referenced System.Windows.Forms.ContextMenu, which was removed in .NET 6+: https://learn.microsoft.com/en-us/dotnet/core/compatibility/windows-forms/6.0/apis-throw-argumentnullexception The new DLLs use ContextMenuStrip instead, which exists on both .NET Framework and .NET 8, so this change is safe for all platforms. Skip the .NET Framework registry check in _is_chromium() when running on coreclr, since coreclr does not register in the .NET Framework registry (HKLM\...\NDP\v4\Full). Also fix a potential UnboundLocalError by initializing net_key before the try block and guarding CloseKey. Add explicit clr.AddReference('Microsoft.Win32.SystemEvents') when PYTHONNET_RUNTIME=coreclr. This assembly is auto-loaded on .NET Framework but requires an explicit reference on coreclr. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
More information, check #1787
I have recently changes my PC and forget to install AutoPeP for vscode