Skip to content

No longer works on 7.0 or above - Giving up #4806

Description

@Webslug

Is there an existing issue for this?

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

CefSharp Version

124.3.80

Operating System

Windows 10

Architecture

x64

.Net Version

7.0

Implementation

WinForms

Reproduction Steps

cefsharp

using CefSharp;
using CefSharp.WinForms;

namespace cefsharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
InitializeChromium();
}

    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        Cef.Shutdown();
        base.OnFormClosing(e);
    }

    private void InitializeChromium()
    {
        chromiumWebBrowser1 = new ChromiumWebBrowser("about:blank")
        {
            Dock = DockStyle.Fill
        };
        this.Controls.Add(chromiumWebBrowser1);

        chromiumWebBrowser1.LoadingStateChanged += chromiumWebBrowser1_LoadingStateChanged;
    }

    private void chromiumWebBrowser1_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
    {
        if (!e.IsLoading)
        {
            // Once the page has finished loading, execute JavaScript to display "Hello, World!" in the browser
            chromiumWebBrowser1.ExecuteScriptAsync("document.body.innerHTML = '<h1>Hello, World!</h1>';");
        }
    }
}

}

using CefSharp.WinForms;
using System.Runtime.ConstrainedExecution;
using CefSharp;
using CefSharp.WinForms;

namespace cefsharp
{
internal static class Program
{
///


/// The main entry point for the application.
///

[STAThread]
static void Main()
{
// Set up CefSharp settings
CefSettings settings = new CefSettings();
// Initialize CefSharp with the provided settings
Cef.Initialize(settings);

        ApplicationConfiguration.Initialize();
        Application.Run(new Form1());
    }
}

}

Expected behavior

I wanted a working web browser. CefSharp just does not work in Visual Studio anymore.

Actual behavior

Does not run or compile.

Regression?

I tried on version 7.0 and version 8.0

Known Workarounds

None found

Does this problem also occur in the CEF Sample Application

Yes using WPF/OffScreen command line args

Other information

using CefSharp;
using CefSharp.WinForms;

namespace cefsharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
InitializeChromium();
}

    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        Cef.Shutdown();
        base.OnFormClosing(e);
    }

    private void InitializeChromium()
    {
        chromiumWebBrowser1 = new ChromiumWebBrowser("about:blank")
        {
            Dock = DockStyle.Fill
        };
        this.Controls.Add(chromiumWebBrowser1);

        chromiumWebBrowser1.LoadingStateChanged += chromiumWebBrowser1_LoadingStateChanged;
    }

    private void chromiumWebBrowser1_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
    {
        if (!e.IsLoading)
        {
            // Once the page has finished loading, execute JavaScript to display "Hello, World!" in the browser
            chromiumWebBrowser1.ExecuteScriptAsync("document.body.innerHTML = '<h1>Hello, World!</h1>';");
        }
    }
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions