Skip to content

Commit d70664f

Browse files
anandhan-rajagopalCopilot
authored andcommitted
[Testing] Fix for flaky device test BlazorWebViewUsesStartPath on Windows (#29966)
* Update WebViewHelpers.Windows.cs * Update WebViewHelpers.Windows.cs * Update src/BlazorWebView/tests/MauiDeviceTests/WebViewHelpers.Windows.cs Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent e8b41ce commit d70664f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/BlazorWebView/tests/MauiDeviceTests/WebViewHelpers.Windows.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ public static partial class WebViewHelpers
1111
public static async Task WaitForWebViewReady(WebView2 wv2)
1212
{
1313
CoreWebView2 coreWebView2 = null;
14+
15+
// Ensure that the WebView2 runtime is installed and initialized and has a CoreWebView2 instance.
16+
if (wv2?.CoreWebView2 == null)
17+
{
18+
string version = CoreWebView2Environment.GetAvailableBrowserVersionString(null);
19+
if (string.IsNullOrEmpty(version))
20+
{
21+
throw new InvalidOperationException("WebView2 runtime is not installed.");
22+
}
23+
await wv2.EnsureCoreWebView2Async();
24+
}
1425

1526
await Retry(() =>
1627
{

0 commit comments

Comments
 (0)