Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 10 2016 09:45
    User @amaitland unbanned @aolko
  • Oct 10 2016 09:36
    @amaitland banned @aolko
  • Feb 11 2016 05:56
    User @amaitland unbanned @miyakedev from this room
  • Feb 10 2016 19:59
    @amaitland banned @miyakedev
dadloo
@dadloo

I have a problem with cors after updating cefsharp.winforms from 79.1.360 to 95.7.141.

Uncaught DOMException: Blocked a frame with origin "akela://" from accessing a cross-origin frame.
    at Player._onLoadWorskpace (webpack:///./pages/player/controller.js?:462:38)
    at HTMLIFrameElement.dispatch (akela://common/assets/js/jquery-latest.min.js:2:41772)
    at HTMLIFrameElement.y.handle (akela://common/assets/js/jquery-latest.min.js:2:39791)
  • i have custom scheme for akela but do not have custom scheme for webpack (never needed to)
  • i have set header for Headers.Add("Access-Control-Allow-Origin", "*");

After update i had to remove (because of the changes):

            this.browser.BrowserSettings.FileAccessFromFileUrls = CefState.Enabled;
            this.browser.BrowserSettings.UniversalAccessFromFileUrls = CefState.Enabled;
            this.browser.BrowserSettings.WebSecurity = CefState.Enabled;

instead i included:

            cefSettings.CefCommandLineArgs.Add("allow-universal-access-from-files");
            cefSettings.CefCommandLineArgs.Add("allow-file-access-from-files");
           //i thought this will help solve the issue (as a last resort, not really comfortable with this solution), but for some reason cors problem is still there (it feels like it is ignored?)
           // cefSettings.CefCommandLineArgs.Add("disable-web-security");
           //cefSettings.CefCommandLineArgs.Add("disable-features", "OutOfBlinkCors");

I am lost at what I can do to make it work again. I have a feeling that my command line arguments are being ignored maybe (at least disable-web-security)? Is there a way to check that those arguments are applied properly?

Francois Larouche
@larouchefrancois

Hello all, hopefully it's an easy one.
I was wondering why some ajax requests are not detected in OnBeforeBrowse when I click in the browser link?
The specific case is as followed in client side code:

<a href="#" onclick="new Ajax.Updater('sidebar', '/account/signup_form', {asynchronous:true, evalScripts:true}); return false;">&lt;&lt; Register</a>

I can detect many types of XHR but not that one.

Alex Maitland
@amaitland

I'm using CefSharp 94.4.50.

@chaitanyajun12 Calling ChromiumWebBrowser.Dispose should close the associated CefSharp.BrowserSubProcess.exe render process instance. Starting in version 95 there is a spare render process that will be closed when Cef.Shutdown is called.

Make sure you are correctly disposing of the browser.

I have a feeling that my command line arguments are being ignored maybe

@dadloo If you load chrome://version/ in the ChromiumWebBrowser instance you should see the command line args

2 replies
Alex Maitland
@amaitland

I was wondering why some ajax requests are not detected in OnBeforeBrowse when I click in the browser link?

@larouchefrancois Do you mean OnBeforeResourceLoad?

3 replies
Alex Maitland
@amaitland

I have a problem with cors after updating cefsharp.winforms from 79.1.360 to 95.7.141.

@dadloo Are you using the file:/// scheme?

2 replies
Alex Maitland
@amaitland

cefSettings.CefCommandLineArgs.Add("disable-features", "OutOfBlinkCors");

@dadloo From memory it's no longer possible to disable OutOfBlinkCors, and a quick check confirms it.
https://magpcss.org/ceforum/viewtopic.php?f=6&t=18157

1 reply
Krishna Chaitanya M
@chaitanyajun12
Thank you @amaitland. Will check.
Serhiy Mashkovskyi
@serhiy1994
Migrating from 90.6.5 to the new release. Is there any analogues to these old parameters?
config.FileAccessFromFileUrls = (!CrossDomainSecurity).ToCefState(); config.UniversalAccessFromFileUrls = (!CrossDomainSecurity).ToCefState(); config.ApplicationCache = ApplicationCache.ToCefState();
Alex Maitland
@amaitland

Migrating from 90.6.5 to the new release. Is there any analogues to these old parameters?

@serhiy1994 Breaking changes are listed in the Releases for each version on GitHub, you'll find details there.

Shishir Halaharvi
@ShishirH

Hello, I am using CefSharp (WPF) for a VSIX project. When I try to run the program, I get a

System.Windows.Markup.XamlParseException
  HResult=0x80131501
  Message='The invocation of the constructor on type 'CefSharp.Wpf.ChromiumWebBrowser' that matches the specified binding constraints threw an exception.' Line number '19' and line position '10'.
  Source=PresentationFramework
  StackTrace:
   at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
   at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
   at P_Inti.MyWindowControl.InitializeComponent() in C:\Dev\P-Inti\P-Inti\MyWindowControl.xaml:line 1

Inner Exception 1:
FileNotFoundException: Could not load file or assembly 'CefSharp.Core.Runtime, Version=95.7.141.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138' or one of its dependencies. The system cannot find the file specified.

I have manually added the following files and set them to copy always:

  1. CefSharp.BrowserSubprocess.exe
  2. CefSharp.BrowserSubprocess.Core.dll
  3. Ijwhost.dll
  4. CefSharp.Core.Runtime.dll
  5. CefSharp.Core.dll
  6. CefSharp.dll
  7. CefSharp.Wpf.dll
  8. libcef.dll
  9. chrome_elf.dll
  10. icudtl.dat
  11. snapshot_blob.bin
  12. v8_context_snapshot.bin

I can find the above files in bin after I build, but I cannot figure out why CefSharp,Core.Runtime is still reported missing.
This is on VS 2022 on Windows 11, with CefSharp version 95.7.141.

Any help would be very appreciated. Thanks in advance!

Alex Maitland
@amaitland

I am using CefSharp (WPF) for a VSIX project

@ShishirH Try using build 96.0.130-CI4313 from https://www.myget.org/feed/cefsharp/package/nuget/CefSharp.Wpf
See if commit cefsharp/CefSharp@5447c8d makes a different.

Ahmed Talaat
@bahnay7:matrix.org
[m]

i have code to get data from html table to datagridview using webbrowser thats my code:
Dim mytable As HtmlElement = WebBrowser1.Document.GetElementById("DataGridemplis")
Dim dtData As DataTable = New DataTable
dtData.Columns.Add("id")
dtData.Columns.Add("name")
dtData.Columns.Add("code")
dtData.Columns.Add("school")
dtData.AcceptChanges()
Dim dr As DataRow = Nothing
For Each row As HtmlElement In mytable.GetElementsByTagName("tr")
dr = dtData.NewRow
Dim cells As HtmlElementCollection = row.GetElementsByTagName("td")
Dim i As Integer = 0
Do While (i < cells.Count)
dr(i) = cells(i).InnerText
i = (i + 1)
Loop
dtData.Rows.Add(dr)
Next
dtData.AcceptChanges()
DataGridView2.DataSource = dtData

and it work very well
but now i use cefsharp chromium and i cant get data from html table to datagridview
I want get data from html table to datagridview using cefsharp

Krishna Chaitanya M
@chaitanyajun12

@amaitland, while running our application with CefSharp support, in few of the VMs we are getting the below crash.

As part of our code, we are stringifying the CefSettings object via JavascriptSerializer. But, we see the below crash happening in few of the machines. Could you let me know if you have faced this anytime before?

17/11/2021 15:16:21 .NET Runtime Error Application: Sample.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.AccessViolationException at System.String.wcslen(Char) at System.String.CtorCharPtr(Char) at CefSharp.Core.CefSettingsBase.get_BrowserSubprocessPath() Exception Info: System.Reflection.TargetInvocationException at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[]) at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) at System.Web.SecurityUtils.MethodInfoInvoke(System.Reflection.MethodInfo, System.Object, System.Object[]) at System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(System.Object, System.Text.StringBuilder, Int32, System.Collections.Hashtable, SerializationFormat) at System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(System.Object, System.Text.StringBuilder, Int32, System.Collections.Hashtable, SerializationFormat, System.Reflection.MemberInfo)

edhalsim
@edhalsim
Hi. I need to detect when a server request, such as the result of clicking a link, generates a non-200 response and pass that info back to my CefSharp.Offscreen program. I'm using an overridden OnResourceResponse to detect the bad status, but I don't know how to get my main program to respond to it. I tried throwing an exception and catch it in my main program to no avail.
Alex Maitland
@amaitland

i have code to get data from html table to datagridview using webbrowser thats my code:

@bahnay7:matrix.org You can acess the DOM using javascript see https://github.com/cefsharp/CefSharp/wiki/General-Usage#2-how-do-you-call-a-javascript-method-that-returns-a-result

A simple example getting the cells from a table might look like:

var response = await webBrowser.EvaluateScriptAsync(@"(function (){
    let srcTable = document.getElementsByTagName('table')[0];
    return Array.from(srcTable.rows, row => Array.from(row.cells, cell => cell.innerText));
    })();
");

dynamic arr = response.Result;

foreach(dynamic row in arr)
{
    foreach(var cell in row)
    {
        var data = (string)cell;
    }
}
Alex Maitland
@amaitland
@chaitanyajun12 I've never seen anyone trying to turn CefSettings into JSON before. Access violation would suggest the unmanaged memory was freed. Are you attempting to access CefSettings after you've called Cef.Initialize? The instance will be automatically Disposed.
3 replies
Alex Maitland
@amaitland
@edhalsim Perhaps http://cefsharp.github.io/api/95.7.x/html/E_CefSharp_OffScreen_ChromiumWebBrowser_FrameLoadEnd.htm suites your purpose. You can get the http status code for the frames main resource load.
5 replies
Serhiy Mashkovskyi
@serhiy1994
By the way, is it possible to open the GitHub CefSharp project in VS2015?
Holger Prause
@holger-prause
hello - i got a question about javsscript errors in the devtool windows
they dont show up if using EvaluateScriptAsync - but they do show up if explicitly calling from devtools console - can i do something there?
Alex Maitland
@amaitland

By the way, is it possible to open the GitHub CefSharp project in VS2015?

@serhiy1994 VS2019 or higher is required.

they dont show up if using EvaluateScriptAsync - but they do show up if explicitly calling from devtools console - can i do something there?

@holger-prause Already asked at https://github.com/cefsharp/CefSharp/discussions/3900

Please just ask your question once and wait for a reply, thanks.

Ramakrishna kolli
@ramkolli:matrix.org
[m]
Hi Team, I have WPF application using Cefsharp, I want to enter text in input field of browser using WPF onscreen keyboard . Guide me right approach
Ramakrishna kolli
@ramkolli:matrix.org
[m]
:point_up: Edit: Hi Team, I have WPF application using Cefsharp, I want to enter text in input field of browser using WPF custom onscreen keyboard . Guide me right approach
Alex Maitland
@amaitland
@ramkolli:matrix.org The http://cefsharp.github.io/api/96.0.x/html/E_CefSharp_Wpf_ChromiumWebBrowser_VirtualKeyboardRequested.htm is called when the browser wants show/hide the keyboard. It's up to you to actually show an onscreen keyboard. The project source has an example OS using the win 10 oak
2 replies
*osk
Nick
@vwmberry95
@amaitland 96.0.170 packages are not in Nuget
Alex Maitland
@amaitland

96.0.170 packages are not in Nuget

@vwmberry95 Thanks, I haven't forgotten. Had a lot of rain here of late including a very heavy downpour which had water in my garage (my computer is in the garage). Had to deal with that as a priority.

Packages should appear shortly.

Nick
@vwmberry95
Great, thanks!
chylex
@chylex
hi, there used to be devtools_resources.pak in packages\cef.redist.x86.<version>\CEF but since about version 90 it's not there anymore, are dev tools always included now?
3 replies
Ramakrishna kolli
@ramkolli:matrix.org
[m]
@amaitland: Google earth (https://earth.google.com/web/) search not working in cefsharp, is their any settings specifically i need to add?
Alex Maitland
@amaitland
@ramkolli:matrix.org See https://github.com/cefsharp/CefSharp/discussions/3826#discussioncomment-1382507 for my suggestions on debugging.
I'd suggest you continue the conversation at https://github.com/cefsharp/CefSharp/discussions/3826
SufferYe
@SufferYe
Hi, I Want playH.264 video on the 96.0version CefWinform.Is it possible? what should i do?
Alex Maitland
@amaitland
@SufferYe It's possible, realistically you are probably better looking for a different browser. See https://github.com/cefsharp/CefSharp/discussions/3601#discussioncomment-828830
8 replies
NqNl
@Xyzsui
Hello
chylex
@chylex
hi, I'm wondering if anyone else ran into an issue, where opening dev tools and then closing the main window makes the dev tools freeze and never close
good thing is it's only happening while debugging, but it used to not happen in the fairly old cefsharp version I updated from
Zhijun
@will8372
Hello, with the newest CefSharp( 96.0.180), CefSharp.MinimalExample.Wpf.netcore can not work for the autofocused text input, is this a bug newly introduced?
Steps to reproduce:
  1. download CefSharp.MinimalExample codes
  2. launch the "CefSharp.MinimalExample.Wpf.netcore" project, the start address is "https://www.google.com".
  3. After the google search main page is loaded, found the caret is blinking to waiting for inputs in the middle input text box.
  4. Some keystrokes to try to type some text in the searching box, but no texts are input in the text box.
  5. Click on the text box, then it can accept the stroked chars.
    it seems the autofocus can not work well now, does anyone knows how to fix this, thanks a lot!
    P.S my IDE is visual studio 2022.
chylex
@chylex
obrazek.png
I'm also running into an issue where trying to load an extension segfaults the subprocess exe, but it doesn't happen if I try to load the same extension into the example project; do you have any tips for debugging the subprocess libraries? seems like extraInfo is null for some reason
Alex Maitland
@amaitland

if anyone else ran into an issue, where opening dev tools and then closing the main window makes the dev tools freeze and never close
good thing is it's only happening while debugging

@chylex MinimalExample looks fine to me. Are you using WinForms or WPF? What do you mean by

What do you mean by debugging? VS has a breakpoint hit and your stepping through code?

can not work for the autofocused text input

@will8372 What exactly is autofocused text input? In WPF you can control the focus using https://docs.microsoft.com/en-us/dotnet/api/system.windows.input.focusmanager.focusedelement?view=windowsdesktop-6.0

The MinimalExample has been updated so the browser now has focus by default. cefsharp/CefSharp.MinimalExample@d752b58

1 reply

seems like extraInfo is null for some reason

Do you have an actual stack trace?

chylex
@chylex

What do you mean by debugging?

Literally just running with a debugger attached, opening dev tools, and closing the main app window. No breakpoints. I guess some CEF/CefSharp configuration in my app is causing both this and the extension issue.

Do you have an actual stack trace?

Exception stack trace:

   at CefSharp.BrowserSubprocess.CefAppUnmanagedWrapper.OnBrowserCreated(CefAppUnmanagedWrapper* , scoped_refptr<CefBrowser>* browser, scoped_refptr<CefDictionaryValue>* extraInfo) in C:\projects\cefsharp\CefSharp.BrowserSubprocess.Core\CefAppUnmanagedWrapper.cpp:line 69
   at CefExecuteProcess(CefMainArgs* , scoped_refptr<CefApp>* , Void* )
   at CefSharp.BrowserSubprocess.SubProcess.Run() in C:\projects\cefsharp\CefSharp.BrowserSubprocess.Core\SubProcess.h:line 57
   at CefSharp.BrowserSubprocess.BrowserSubprocessExecutable.Main(IEnumerable`1 args, IRenderProcessHandler handler) in C:\projects\cefsharp\CefSharp.BrowserSubprocess.Core\BrowserSubprocessExecutable.h:line 150
   at CefSharp.BrowserSubprocess.Program.Main(String[] args) in C:\projects\cefsharp\CefSharp.BrowserSubprocess\Program.cs:line 33

Call stack when attaching a debugger during the exception:

>    CefSharp.BrowserSubprocess.Core.dll!CefSharp::BrowserSubprocess::CefAppUnmanagedWrapper::OnBrowserCreated(scoped_refptr<CefBrowser>* browser, scoped_refptr<CefDictionaryValue>* extraInfo) Line 69    C++
     [Native to Managed Transition]    
     [Managed to Native Transition]    
     CefSharp.BrowserSubprocess.Core.dll!CefSharp::BrowserSubprocess::SubProcess::Run() Line 57    C++
     CefSharp.BrowserSubprocess.Core.dll!CefSharp::BrowserSubprocess::BrowserSubprocessExecutable::Main(System::Collections::Generic::IEnumerable<System::String^>^ args, CefSharp::RenderProcess::IRenderProcessHandler^ handler) Line 150    C++
     CefSharp.BrowserSubprocess.exe!CefSharp.BrowserSubprocess.Program.Main(string[] args) Line 37    C#
chylex
@chylex
For some reason renderer-startup-dialog doesn't prevent the extension subprocess from crashing, if I let the other subprocesses run then it still crashes after showing the startup dialog box. But I got VS to show this, which is a bit more clear, but I still don't know where extraInfo came from in the call stack.
obrazek.png