alternetsoft / AlternetUI

MIT License
24 stars 2 forks source link

Problem with WebBrowser.NavigateToString() #71

Closed neoxeo closed 8 months ago

neoxeo commented 8 months ago

@generalloki

Version : 0f81a342224beaa98e73088392fab971b763c9f6

  private void loadWebBrowser()
    {
        string html = "<html><body><h1>Sample HTML File</h1><p>First Sample paragraph.</p><p>Second Sample paragraph.</p></body></html>";
        webBrowser1.NavigateToString(html);
    }

Error : image

neoxeo commented 8 months ago

@generalloki

Version : 3298e9d8f0776af1ce72f5de32e104fa6c589640

This issue seems not to be fixed for me : image

// webbrowser sample
private void loadWebBrowser()
{
    // webBrowser1 load local html file
    string html = "<html><body><h1>Sample HTML File</h1><p>First Sample paragraph.</p><p>Second Sample paragraph.</p></body></html>";
    webBrowser1.NavigateToString(html);
}
generalloki commented 8 months ago

@neoxeo, Could you please attach the full project with the problem? Also copy/paste error text so I could translate it to English? I have checked the problem in ControlsTest project (test action "Navigate To String") and it works fine. Also is it IE or Edge?

neoxeo commented 8 months ago

@generalloki

Sorry, yes.

Here is error in english : image

System.AccessViolationException : 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Here is a testproject to reproduce error : testWebBrowser.zip

generalloki commented 8 months ago

I run project from testWebBrowser.zip and it's fine. Used cmd: dotnet run --framework net8.0

image

So something could be with your Edge installation. Try to use IE backend. This call sets desired backend version WebBrowser.SetBackend(WebBrowserBackend value)

neoxeo commented 8 months ago

@generalloki

I will test this quickly. Strange thing is that navigate url works fine

neoxeo commented 8 months ago

@generalloki

After clean .nuget cache and generate new nuget packages with latest version, all works fine with Edge and IE.

I don't know what is the reason of error but now it is solve. Sorry.