CoreWebView2Environment Class

Definition

This represents the WebView2 Environment.

public class CoreWebView2Environment
type CoreWebView2Environment = class
Public Class CoreWebView2Environment
Inheritance
CoreWebView2Environment

Remarks

WebViews created from an environment run on the Browser process specified with environment parameters and objects created from an environment should be used in the same environment. Using it in different environments are not guaranteed to be compatible and may fail.

Properties

BrowserVersionString

Gets the browser version info of the current CoreWebView2Environment, including channel name if it is not the stable channel.

FailureReportFolderPath

Gets the failure report folder that all CoreWebView2s created from this environment are using.

LoaderDllFolderPath

The relative or absolute folder's path where WebView2Loader.dll exists. If LoaderDllFolderPath is set, we will load %LoaderDllFolderPath%\WebView2Loader.dll first.

RenderAdapterLUID

Retrieves the browser's adapter LUID.

UserDataFolder

Gets the user data folder that all CoreWebView2s created from this environment are using.

Methods

CompareBrowserVersions(String, String)

Compares two instances of browser versions correctly and returns an integer that indicates whether the first instance is older, the same as, or newer than the second instance.

CreateAsync(String, String, CoreWebView2EnvironmentOptions)

Creates a WebView2 Environment using the installed or a custom WebView2 Runtime version.

CreateContextMenuItem(String, Stream, CoreWebView2ContextMenuItemKind)

Create a custom CoreWebView2ContextMenuItem object to insert into the WebView context menu.

CreateCoreWebView2CompositionControllerAsync(IntPtr)

Asynchronously creates a new WebView for use with visual hosting.

CreateCoreWebView2CompositionControllerAsync(IntPtr, CoreWebView2ControllerOptions)

Asynchronously creates a new CoreWebView2CompositionController object.

CreateCoreWebView2CompositionControllerWithOptionsAsync(IntPtr, CoreWebView2ControllerOptions)

Create a new webview in visual hosting mode with CoreWebView2ControllerOptions as parameter for multiple profiles support.

CreateCoreWebView2ControllerAsync(IntPtr)

Asynchronously creates a new WebView.

CreateCoreWebView2ControllerAsync(IntPtr, CoreWebView2ControllerOptions)

Asynchronously creates a new CoreWebView2Controller object.

CreateCoreWebView2ControllerOptions()

Creates a new CoreWebView2ControllerOptions object, which can be passed as a parameter in CreateCoreWebView2ControllerAsync(IntPtr, CoreWebView2ControllerOptions) and CreateCoreWebView2CompositionControllerAsync(IntPtr, CoreWebView2ControllerOptions) function for multiple profiles support.

CreateCoreWebView2ControllerOptions(String, Int32)

Create a new CoreWebView2ControllerOptions object, which can be passed as a parameter in CreateCoreWebView2ControllerAsync(IntPtr, CoreWebView2ControllerOptions) and CreateCoreWebView2CompositionControllerAsync(IntPtr, CoreWebView2ControllerOptions) function for multiple profiles support.

CreateCoreWebView2ControllerWithOptionsAsync(IntPtr, CoreWebView2ControllerOptions)

Create a new webview with CoreWebView2ControllerOptions as parameter for multiple profiles support.

CreateCoreWebView2PointerInfo()

Creates an empty CoreWebView2PointerInfo.

CreatePrintSettings()

Creates the CoreWebView2PrintSettings used by the PrintToPdfAsync(String, CoreWebView2PrintSettings) method.

CreateSharedBuffer(UInt64)

Create a shared memory based buffer with the specified size in bytes.

CreateTextureStream(String, Object)

Creates texture stream.

CreateWebFileSystemDirectoryHandle(String, CoreWebView2FileSystemHandlePermission)

Creates a CoreWebView2FileSystemHandle object from a path that represents a Web FileSystemDirectoryHandle.

CreateWebFileSystemFileHandle(String, CoreWebView2FileSystemHandlePermission)

Creates a CoreWebView2FileSystemHandle object from a path that represents a Web FileSystemFileHandle.

CreateWebResourceRequest(String, String, Stream, String)

Creates a new CoreWebView2WebResourceRequest object.

CreateWebResourceResponse(Stream, Int32, String, String)

Creates a new CoreWebView2WebResourceResponse object.

GetAvailableBrowserVersionString(String)

Gets the browser version info including channel name if it is not the stable channel or WebView2 Runtime.

GetAvailableBrowserVersionString(String, CoreWebView2EnvironmentOptions)

Gets the browser version info including channel name if it is not the stable channel or WebView2 Runtime.

GetProcessExtendedInfosAsync()

Returns a snapshot collection of CoreWebView2ProcessInfo corresponding to all currently running processes associated with this CoreWebView2Environment excludes crashpad process. This provides the same list of CoreWebView2ProcessInfo as what's provided in GetProcessInfos(), but additionally provides a list of associated CoreWebView2FrameInfo which are actively running (showing or hiding UI elements) in the renderer process. See AssociatedFrameInfos for more information.

GetProcessInfos()

Returns the list of all CoreWebView2ProcessInfo using same user data folder except for crashpad process.

GetProcessInfosWithDetailsAsync()

Returns a snapshot collection of CoreWebView2ProcessInfo corresponding to all currently running processes associated with this CoreWebView2Environment excludes crashpad process. This provides the same list of CoreWebView2ProcessInfo as what's provided in GetProcessInfos(), but additionally provides a list of associated CoreWebView2FrameInfo which are actively running (showing or hiding UI elements) in the renderer process. See AssociatedFrameInfos for more information.

GetProviderForHwnd(IntPtr)

Returns the UI Automation Provider for the CoreWebView2CompositionController that corresponds with the given hwnd.

SetLoaderDllFolderPath(String)

Set the path of the folder containing the WebView2Loader.dll.

UpdateRuntimeAsync()

Try to update the installed Microsoft Edge WebView2 Runtime.

Events

BrowserProcessExited

BrowserProcessExited is raised when the collection of WebView2 Runtime processes for the browser process of this CoreWebView2Environment terminate due to browser process failure or normal shutdown (for example, when all associated WebViews are closed), after all resources have been released (including the user data folder).

NewBrowserVersionAvailable

NewBrowserVersionAvailable is raised when a newer version of the WebView2 Runtime is installed and available using WebView2.

ProcessInfosChanged

ProcessInfosChanged is raised when a collection of WebView2 Runtime processes changed due to new process being detected or when a existing process gone away.

RenderAdapterLUIDChanged

Registers the browser adapter LUID changed event.

Applies to