Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EvaluateScriptAsync for SelfContained application #4727

Closed
1 task done
Zelya opened this issue Feb 22, 2024 · 0 comments
Closed
1 task done

EvaluateScriptAsync for SelfContained application #4727

Zelya opened this issue Feb 22, 2024 · 0 comments

Comments

@Zelya
Copy link

Zelya commented Feb 22, 2024

Is there an existing issue for this?

  • I have searched both open/closed issues, no issue already exists.

CefSharp Version

121.3.70

Operating System

Windows 11

Architecture

x64

.Net Version

NET 8.0

Implementation

WPF

Reproduction Steps

  1. Add EvaluateScriptAsync code to your project, like this
        private async void Browser_LoadingStateChanged(object? sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            string script = @"document.querySelector('someelement')";

            var response = await Browser.GetFocusedFrame().EvaluateScriptAsync(script, null);

            if (response.Success)
            {

It works OK.
2. In order to make browser working with SelfContained=true (see #3407) add code sninppet from MinimalExample https://github.com/cefsharp/CefSharp.MinimalExample/blob/master/CefSharp.MinimalExample.Wpf/Program.PublishSingleFile.cs
This is the most valuable part.

            var settings = new CefSettings()
            {
                CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache"),
                BrowserSubprocessPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName
            };

            Cef.Initialize(settings, performDependencyCheck: false);
  1. Now EvaluateScriptAsync hangs forever.

Expected behavior

EvaluateScriptAsync should work for app with SelfContained=true

Actual behavior

EvaluateScriptAsync hangs for app with SelfContained=true and workaround from MinimalExample

Regression?

No response

Known Workarounds

No response

Does this problem also occur in the CEF Sample Application

Not Tested

Other information

No response

@cefsharp cefsharp locked and limited conversation to collaborators Feb 22, 2024
@amaitland amaitland converted this issue into discussion #4728 Feb 22, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant