Releases: ioa747/NetWebView2Lib
Release list
v2.2.2-alpha
Version v2.2.2-alpha
Configurable Message Throttling
Provide a configurable throttling mechanism for messages sent from JavaScript to AutoIt via the WebView2 bridge to prevent message loss when throttling is too restrictive for certain use cases, while keeping safety defaults.
⚡ Key Features & Enhancements
-
Implement the ThrottlingIntervalMs property on the manager class, forwarding to the bridge object.
ThrottlingIntervalMs [Property]: Gets or sets the throttling interval in milliseconds for messages sent from JavaScript to AutoIt. Set to 0 to disable throttling entirely. Default is 20 ms.
v2.2.1-alpha1
Version 2.2.1-alpha1
Critical UI Responsiveness & Locking Fixes
- Fixed: Unresponsive F12 & Context Menu: Resolved a critical issue where Developer Tools and Right-Click menus would become unresponsive or "missing" (Inspect) after navigation.
- Root Cause: Identified as COM overhead during dual event sink processing and synchronous state lag when toggling engine properties.
- Improved: Interception-Based Locking: Refactored
LockWebView/UnLockWebViewto be 100% reliable.- Instead of toggling engine settings (which caused UI flickering), the library now stays permanently "Open" at the engine level but intercepts and blocks events via the
_isLockedflag in C#.
- Instead of toggling engine settings (which caused UI flickering), the library now stays permanently "Open" at the engine level but intercepts and blocks events via the
- C# Fast Path Optimization: F12 and basic context menus are now handled directly in C# whenever possible, bypassing the AutoIt COM layer for instant response times.
- Robust AutoIt Navigation:
_NetWebView2_Navigateand_NetWebView2_NavigateToStringnow use a guaranteedUnLockWebViewpattern, preventing the browser from remaining locked on navigation errors. - Refactored: OnDownloadStarting Event: Transitioned from a parameter-based signature to a robust, object-oriented argument model.
- New Argument Wrapper:
IWebView2DownloadStartingEventArgsprovides access toUri,ResultFilePath,Handled,Cancel,MimeType,ContentDisposition, andTotalBytesToReceive. - Hybrid Deferral Model: Implemented a performance-optimized synchronization mechanism using
CoreWebView2Deferral. The C# core now waits up to 5000ms for AutoIt to setHandledorCancelon the argument object, proceeding immediately once a decision is made. - MimeType Support (Issue #123): Exposed
MimeTypedirectly in the download arguments, allowing AutoIt scripts to identify "unviewable content" (e.g., PDFs, ZIPs) at the start of the download lifecycle.
- New Argument Wrapper:
- Refactored: OnWebResourceResponseReceived Event: Transitioned to an object-oriented argument model for consistent event handling.
- New Argument Wrapper:
IWebView2WebResourceResponseReceivedEventArgsprovides access toStatusCode,ReasonPhrase,RequestUri, andIsDocument. - Buffered Property Pattern: Applied to ensure thread-safe access from AutoIt (STA/COM compatibility).
- Refactored: OnDownloadStateChanged Event: Transitioned to an object-oriented argument model for consistent event handling.
- New Argument Wrapper:
IWebView2DownloadStateChangedEventArgsprovides access toState,Uri,TotalBytesToReceive,BytesReceived, and a newPercentCompletehelper. - Buffered Property Pattern: Applied to ensure thread-safe progress updates during rapid download cycles.
- New Argument Wrapper:
- Fixed: HTTP Status Code Detection: Resolved a bug where
OnWebResourceResponseReceivedfailed to fire due to a missing legacy header hack. Replaced with nativeResourceContextdetection. - Improved: Download Logic: Automatic redirection to
_customDownloadPathis now applied before the event fires, allowing AutoIt to see and potentially override the final destination.
v2.2.1-alpha
Version 2.2.1-alpha
Critical UI Responsiveness & Locking Fixes
- Fixed: Unresponsive F12 & Context Menu: Resolved a critical issue where Developer Tools and Right-Click menus would become unresponsive or "missing" (Inspect) after navigation.
- Root Cause: Identified as COM overhead during dual event sink processing and synchronous state lag when toggling engine properties.
- Improved: Interception-Based Locking: Refactored
LockWebView/UnLockWebViewto be 100% reliable.- Instead of toggling engine settings (which caused UI flickering), the library now stays permanently "Open" at the engine level but intercepts and blocks events via the
_isLockedflag in C#.
- Instead of toggling engine settings (which caused UI flickering), the library now stays permanently "Open" at the engine level but intercepts and blocks events via the
- C# Fast Path Optimization: F12 and basic context menus are now handled directly in C# whenever possible, bypassing the AutoIt COM layer for instant response times.
- Robust AutoIt Navigation:
_NetWebView2_Navigateand_NetWebView2_NavigateToStringnow use a guaranteedUnLockWebViewpattern, preventing the browser from remaining locked on navigation errors. - Persistence Fix: Resolved state corruption where
SetLockStatewould accidentally overwrite user preferences (LikeAreDevToolsEnabled=True) withFalse.
v2.2.0-alpha
Version 2.2.0-alpha
Event Object Refactoring (Navigation Interception)
This release refactors key events to use object-based arguments, enabling advanced control like navigation cancellation.
- Breaking Change:
OnNavigationStartingandOnFrameNavigationStartingnow pass anArgsobject instead of a raw URL string. - New Event Argument Wrapper:
IWebView2NavigationStartingEventArgs:Uri: [Property] The target URL.Cancel: [Property] Get/Set boolean to cancel the navigation.IsUserInitiated: [Property] Indicates if the navigation was user-triggered.IsRedirected: [Property] Indicates if it's a redirect.NavigationId: [Property] Unique identifier for the navigation.
v2.1.0-alpha
Version 2.1.0-alpha
Frame Object Enrichment & Permission Events
This release enriches the WebView2Frame COM object and adds page-level permission handling.
-
New Frame Properties (
IWebView2Frame):FrameId: (DispId 9) [Property] Returns the unique identifier of the frame (assigned by the browser).Source: (DispId 10) [Property] Returns the current URL of the frame. Uses reflection-based SDK-independent retrieval.
-
New Manager Method (
WebView2Manager):GetFrameById(frameId): (DispId 230) [Method] Returns aWebView2FrameCOM object matching the specifiedFrameId. ReturnsNullif not found.
-
New Events:
OnPermissionRequested: (DispId 239) [Event] Fired when the page requests a permission (Geolocation, Camera, Microphone, etc.). ProvidesPermissionKind,State,Uri,IsUserInitiated,Handled, and deferral support viaGetDeferral()/Complete().OnFramePermissionRequested: (DispId 238) [Event] Frame-level variant of the above, also passes theIWebView2Frameobject.
-
Frame Event DispId Assignments:
OnFrameCreated(234),OnFrameDestroyed(235),OnFrameNameChanged(236),OnFramePermissionRequested(238).
v2.0.0-stable
Current Version: Version 2.0.0-stable
Patch: Enriched Verbose Logging
Diagnostic Visibility & Traceability
This patch significantly enhances the Verbose diagnostic mode with a new format and comprehensive event logging.
- New Log Format: Introduced a high-visibility prefix and instance tracking.
- Format:
+++[NetWebView2Lib][HANDLE:0x...][HH:mm:ss.fff] Message - Traceability: The
ParentWindowHandleis now included in every log line, allowing developers to distinguish logs between multiple concurrent WebView2 instances.
- Format:
- Enriched Event Logging: Added diagnostic traces to all critical lifecycle events:
- Navigation:
NavigationStarting(Target URI),NavigationCompleted(Success/Error Status),SourceChanged(New URL). - Interaction:
ContextMenuRequested(Location & Target Kind),WebMessageReceived(Raw payload). - Networking:
WebResourceRequested(URI & Context),WebResourceResponseReceived(Status Code & Reason),BasicAuthenticationRequested(URI). - State:
GotFocus,LostFocus(including True vs. Internal check),ProcessFailed(Kind & Reason),NewWindowRequested(Target URI).
- Navigation:
- API Method Logging: Added traces for key API calls:
Navigate,ExecuteScript(with content truncation),PostWebMessage.AddExtension,RemoveExtension(with Path/ID logging).
- Default Folder Sync: Renamed the default failure report folder from
CrashestoFailureReportFolderto align with official WebView2 parameter naming conventions. - Indentation & Integrity: Standardized the logging calls within event lambdas to maintain clean source code.
Patch: Compiler Scope & Null Check Optimization
Maintenance & Code Health
- Fixed
CS0136: Resolved variable redeclaration scope conflicts in theWebResourceResponseReceivedevent handler. - Improved Null Safety: Refactored the response handler to proactively check for
e.Responseavailability, preventing potential exceptions. - Simplified Cleanup (
IDE0031): Implemented the null-conditional operator (?.) in theCleanup()method for more concise and modern C# syntax.
Version 2.0.0-stable
COM Standardizing & Consistency (Major Release)
This release establishes a consistent naming convention for COM objects while ensuring 100% backward compatibility for legacy scripts.
- Standardized Naming (Architecture):
- Renamed internal classes and ProgIDs to follow the
NetWebView2Lib.WebView2{Subsystem}pattern. - WebView2Manager: New ProgID
NetWebView2Lib.WebView2Manager(formerlyNetWebView2.Manager). - WebView2Bridge: New ProgID
NetWebView2Lib.WebView2Bridge(formerlyNetWebView2Lib.WebViewBridge). - WebView2Parser: New ProgID
NetWebView2Lib.WebView2Parser(formerlyNetJson.Parser).
- Renamed internal classes and ProgIDs to follow the
- Compatibility Layer:
- Implemented inheritance-based compatibility. Creating objects using old ProgIDs still works perfectly but uses the new logic internally.
- AutoIt UDF Sync:
NetWebView2Lib.au3updated to use the new standardized ProgIDs by default. This ensures thatObjName()reports the consistent professional naming for new projects using the UDF.
- Project Structure:
- Renamed C# core files for consistency:
WebView2Manager.cs,WebView2Bridge.cs,WebView2Parser.cs.
- Renamed C# core files for consistency:
- IFrame HTML Extraction: High-performance extraction of HTML from cross-origin iframes.
- SDK Resilience (Reflection): Added reflection-based fallback for
CoreWebView2Frame.Urito maintain compatibility across different WebView2 SDK versions. - SDK Locking Policy (Standardization):
- NuGet Version: Locked to 1.0.2739.15 (Release Date: August 26, 2024).
- Rationale: This version ensures maximum compatibility across the "Evergreen" cycle on most Windows installations while providing all necessary features (Frames, Basic Auth, Process Failure events).
- Runtime Requirement: Requires WebView2 Runtime 128.0.2739.15 or higher.
- Runtime Validation:
Register_web2.au3now performs a strict check for the minimum required runtime version.
- DispId Normalization: Resolved DispId conflict for
Verbosemode (now DispId 228).
v2.0.0-beta.3
Version 2.0.0-beta.3
Refactoring & Keyboard Logic
AcceleratorKeyPressedExpansion:- Added
PhysicalKeyStatusproperties toIWebView2AcceleratorKeyPressedEventArgs:RepeatCount,ScanCode,IsExtendedKey,IsMenuKeyDown,WasKeyDown,IsKeyReleased. - Flattened the
CoreWebView2PhysicalKeyStatusstruct for direct COM/AutoIt access.
- Added
- Code Modularity:
- Extracted
WebView2AcceleratorKeyPressedEventArgsinto its own standalone file (WebView2AcceleratorKeyPressedEventArgs.cs). - Cleaned up
WebViewManager.csby removing 150+ lines of embedded argument logic.
- Extracted
- Build & Alignment:
- Updated
.csprojfor modular file support. - Resolved int-to-bool casting issues for keyboard state fields.
- Updated
Version 2.0.0-beta.2
COM Version Exposure & Stabilization
This update focuses on developer productivity by exposing the DLL version directly to COM and establishing a central version utility.
Added (C# Core)
.versionProperty:- DispId 224 (
WebViewManager) - DispId 2 (
WebViewBridge) - DispId 230 (
JsonParser) - Allows AutoIt to verify the DLL version at runtime for compatibility checks.
- DispId 224 (
- AssemblyUtils Detector:
- New internal utility to retrieve
AssemblyInformationalVersionfrom metadata.
- New internal utility to retrieve
- Advanced Handle Formatting (
[HANDLE:0x...]):- Pivoted all handle-returning strings to the
[HANDLE:0x...]format for out-of-the-box AutoIt compatibility withWinExists,WinMove, etc.
- Pivoted all handle-returning strings to the
- New Properties:
ParentWindowHandle(DispId 229): Returns the handle provided during initialization in Advanced format.
- New Events:
OnProcessFailed(DispId 225): Detailed crash/failure reporting.OnBasicAuthenticationRequested(DispId 228): Handles browser-level auth prompts.
v2.0.0-beta.1
Version 2.0.0-beta.1
Multi-Instance & Sender-Aware Architecture
This major version introduces breaking changes to support professional multi-instance applications by making all COM events "Sender-Aware".
Changed (C# Core)
- Sender-Aware Events:
- All events now include the parameters
(object sender, object parentHandle, ...)to allow AutoIt to distinguish which instance fired the event.
- All events now include the parameters
- Architecture Refactor:
WebViewBridgenow holds a "Sealed" context linked to its specificWebViewManagerand parentHWND.
- Pre-emptive Key Blocking (Stability Phase):
- Abandoned Sync-Wait Loop: Removed the legacy approach of waiting for AutoIt's
Handled = TrueinOnAcceleratorKeyPressedvia a poll loop. This was causing intermittent COM deadlocks and re-entrancy issues. - Synchronous Veto: Replaced with
BlockedVirtualKeysproperty. Blocking is now performed immediately in C# based on a pre-defined list, ensuring 100% reliability for keys like F5 and F12.
- Abandoned Sync-Wait Loop: Removed the legacy approach of waiting for AutoIt's
- Internal Messaging Overlay:
InternalPushMessage: Implemented a secondary messaging layer to handle internal state updates and events that require UI-thread marshalling without triggering external COM event floods.
Added (C# Core)
BrowserWindowHandle: (222) [Property] Exposes the internal window handle (HWND) of the WebView2 control as a COM-friendly object. Allows users to perform native Win32 operations (likeSendMessageor custom subclassing) directly on the browser window.OnAcceleratorKeyPressedRestoration: (221) [Event] Restored functionality using Reflection to access the internalCoreWebView2Controller.BlockedVirtualKeys: (223) [Property] Allows defining a comma-separated list of VK codes to be blocked synchronously and pre-emptively by the C# core, bypassing COM sync issues.
v1.5.0
Version 1.5.0
Advanced Networking & Download Management
This update introduces deep integration with Chromium's networking layer and programmatic control over the download lifecycle.
Added
- HTTP Status Code Tracking (DispId 5):
OnWebResourceResponseReceived(statusCode, reasonPhrase, requestUrl): [Event] Captures the HTTP status code for every resource request (e.g., 404, 500), enabling precise error handling in AutoIt.HttpStatusCodeEventsEnabled: (195) [Property] Master switch to enable or disable the status code event entirely.HttpStatusCodeDocumentOnly: (196) [Property] Filters status code events to only trigger for the main document (Default: True). This prevents event floods that cause GUI deadlocks in AutoIt.
- Custom Download Management (DispIds 204 - 211):
SetDownloadPath(path): (204) [Method] Forces downloads to a specific folder or file. If a directory is provided, the filename is automatically appended.IsDownloadUIEnabled: (205) [Property] Control visibility of the browser's download bubble.OnDownloadStarting: (208) [Event] Intercepts downloads. Features a simplified contract (URI, DefaultPath). Overrides are now handled via dedicated properties/methods (SetDownloadPath,IsDownloadHandled).OnDownloadStateChanged: (209) [Event] Real-time progress (bytes) and state updates.CancelDownloads(uri): (210) [Method] Cancels downloads. Ifuriis empty or omitted, cancels all active downloads.IsDownloadHandled: (211) [Property] Set toTrueduringOnDownloadStartingto suppress the default download UI.ActiveDownloadsList: (214) [Property] Returns a pipe-separated string of all active download URIs.
- Enhanced Export & Snapshot Engine (DispIds 201, 207):
CaptureSnapshot(cdpParameters): (201) [Method] Direct access to CDP snapshots (e.g., MHTML).ExportPageData(format, filePath): (207) [Method] Simplified HTML/MHTML export. Note: Moved to DispId 207 to distinguish from raw CDP snapshots.
- Binary Data Support:
DecodeB64ToBinary(base64Text): (206) [Method] Decodes Base64 to raw byte arrays (binary).
- Manual Download Mode: Added logic to
DownloadStartingthat checksIsDownloadHandled. If set toTrueby AutoIt during the event wait loop, the native Edge download is cancelled (e.Cancel = true), allowing AutoIt to handle the download externally (e.g., viaInetGet). - Download Sync-Wait: A 600ms synchronization loop ensures that property changes in AutoIt are correctly picked up by C# before the download proceeds or is cancelled.
- UnLockWebView Method: Added
UnLockWebView()(215) to re-enable restricted features previously disabled byLockWebView(). - Zoom Control: Added
IsZoomControlEnabled(212) [Property] specify if zoom (Ctrl+Wheel) is enabled. - Scrollbar Control: Added
IsScrollbarEnabled(213) [Property] Toggle scrollbars via CSS overflow injection.
Fixed
- Smart Auto-Fill: Updated
Initializeto automatically calculate initial parent dimensions when 0 width/height are provided. Note: Dynamic resizing remains disabled unless$oWeb.SetAutoResize(True)is called explicitly. - Naming Consistency: Standardized method names (e.g.,
CaptureSnapshot) across C# and COM interfaces. - Build Efficiency: Resolved IDE warnings (
CS0067) and unnecessary#pragmadirectives. - GUI Deadlock (HttpStatusCode): Fixed a critical issue where an flood of 404 resource responses for sub-elements (images, CSS, scripts) would overwhelm the AutoIt event loop, causing the GUI to freeze. Added robust tracking to ensure these events are filtered to the main document by default.
- Download Race Condition Fix: Added
Application.DoEvents()to theOnDownloadStartingevent to ensure AutoIt property overrides (DownloadResultPath,IsDownloadHandled) are synchronized correctly before the download begins. - Automatic Directory Creation: Implemented automatic folder creation for custom download paths if the target directory does not exist.
- Event Fixes: Wired up the
OnZoomChangedevent to correctly trigger when the browser zoom level is modified.
v1.4.3
Version 1.4.3 - (2026-01-20)
COM Robustness & Performance
This update focuses on deepening COM compatibility and resolving assembly discovery issues in AutoIt, along with specialized scraping tools for the main showcase.
Fixed
- COM Event Discovery (0x80028017): Resolved the "Field name not defined" error in AutoIt by explicitly requiring the 3rd parameter in
ObjEventfor .NET-exported interfaces. Documented the necessity of interface names (e.g.,IWebViewEvents) for reliable connection point binding. - Smart AutoResize (Dynamic Margins): Refined
SetAutoResizeto automatically calculate margins based on thewidthandheightpassed toInitialize. This allows users to request absolute sizes (e.g., leaving a specific gap for a status bar) and have those gaps preserved naturally as the parent window resizes.
Added
- Additional Browser Arguments (DispId 100):
- Added
AdditionalBrowserArgumentsproperty. Allows passing command-line switches (e.g.,--disable-gpu,--mute-audio,--proxy-server="...") to the Chromium engine. Note: This must be set before callingInitialize().
- Added
- Advanced JSON Manipulation (JsonParser) (DispIds 225 - 228):
GetTokenCount(path): (225) Returns the count of array items or object properties.GetKeys(path, delimiter): (226) Returns a delimited string of all property names for an object.SortArray(path, key, desc): (227) Sorts a JSON array in-place based on a specific key.SelectUnique(path, key): (228) Removes duplicates from a JSON array based on a key's value.
- Advanced Export & PDF Management (DispIds 201 - 203):
ExportPageData(format, filePath): (201) Saves the current page as HTML (0) or MHTML (1). The MHTML snapshots are captured via CDP and parsed natively. Supports returning content as a string iffilePathis empty.PrintToPdfStream(): (202) Captures the page as a PDF and returns a Base64 string directly to AutoIt, eliminating temporary file requirements.HiddenPdfToolbarItems: (203) [Property] Bitwise control for the PDF viewer's toolbar (e.g., hiding print/save buttons).
Changed
- Interface Protocol (Dual Binding): Upgraded
IWebViewActionsandIJsonParsertoInterfaceIsDual. This enables support for both Early Binding (performance) and Late Binding (flexibility) simultaneously, improving overall stability in diverse COM environments. SetTokenValue(JsonParser) Upgrade: Now supports Deep Creation (automatic creation of parent objects) and Smart Typing (automatic conversion of "true", "false", "null" and numbers, while preserving leading zeros in strings like "0123").WebViewManager.csReorganization: Completely restructured the 1500+ line class into 17 logical regions for better IDE maintainability and code folding.GetArrayLength(JsonParser): Refactored to internally use the more robustGetTokenCountlogic.