Facing Cefsharp.BrowserSubprocess has stopped working after cefsharp version update - cefsharp

We have a VB windows application project using Cefsharp to display browser screen to display some data.
As part of Angular upgrade we have migrated our current cefsharp version from 75.1.142 to 98.1.21.
Reason for not updating to latest cefsharp version is when we did the update the application layout is completely affected, font size reduced, controls broken. So we forced to use lower versions.
We used nuget package manager to update the current version.
It is working fine in our local machine, but after deploying the changes to deployment machine we are getting this
Cefsharp.BrowserSubprocess has stopped working
A problem caused the program to stop working...
Please Note: when we compare the .csproj after the update to 98.1.21 we can see that Cefsharp.Winform is now missing in our latest changes under the imported project lists
Please Note: currently we are using cefsharp in our 2 projects and Target Framework used of these 2 projects are 4.6.2
This is what we have in our CefSettings initialization method
Dim settings As CefSettings = New CefSettings()
settings.remotedebuggingport = findafreetcpport()
settings.cefcommandlineargs.add("disable-gpu", "1")
settings.logfile = ceflogfilename
settings.logseverity = logsiviertity.error
cefsharp.cef.initialize(settings)
And my ChromiumBrowser is initialized like this
_chromeBrowser = new ChromiumWebBrowser(url)
_chromeBrowser.JavascriptObjectRepository.Settings.LedgacyBindingEnabled = True
_chromeBrowser.JavascriptObjectRepository.register("bond", new ChromiumWebBrowserEventHandler(Me),True,BindingOptions.DefaultBinder)
Please note: i haven't provided any BrowserSubProcesssPath during my cefsettings
And in my both .csproj files I have this
<cefsharpanycpusupport>true</cefsharpanycpusupport>
please let me know if you need to know how is my .csproj is configured with cefsharp dll paths.
we also tried different versions but same error is popping out
Any idea why i am facing this problem

Finally after many days of nail biting I managed to solve this problem by doing this steps..
Updated Cefsharp version with Cefsharp 107.1.121 (latest version was affecting our current windows application layouts. So we forced to stick with this version)
Moved LedgacyBindingEnabled = True from my cefsettings to ChromiumWebBrowser initialization section like below
_chromeBrowser = new ChromiumWebBrowser(url)
_chromeBrowser.JavascriptObjectRepository.Settings.LedgacyBindingEnabled = True
_chromeBrowser.JavascriptObjectRepository.register("bond", new
ChromiumWebBrowserEventHandler(Me),True,BindingOptions.DefaultBinder)
Modified cefsettings section by removing the LedgacyBindingEnabled = True code
Then set this broswersubprocess path to absolute (Important) one like this
Dim assemblyPath = System.IO.Path.GetDirectoryName(System.reflection.assembly.GetExecutingAssembly.Location)
If assemblyPath.EndsWith("\") == False Then
assemblyPath = assemblyPath & "\"
End If
Settings.BrowserSubProcesssPath = assemblyPath &
"Cefsharp.BrowserSubprocess.exe"
Hope it helps to someone who updates ur Angular version and stuck because of CefSharp version change.

Related

CefSharp with Any CPU fails to display browser

First up, I'm fairly new to .NET and C# and this is a project to learn C# and CEF at the same time.
I have followed a number of tutorials from the net as well as looking into the CefSharp examples to create a WinForms application.
I have installed CefSharp.WinForms 53.0.1 from NuGet, and my project is using Any CPU (CefSharp 51+ has Any CPU support).
To achieve this I largely followed the tutorial from Ourcode (http://ourcodeworld.com/articles/read/173/how-to-use-cefsharp-chromium-embedded-framework-csharp-in-a-winforms-application). I made the changes for Any CPU as suggested and included the basic code to load google.
Everything builds fine, but when the form displays there's no browser shown, just a blank form.
If I set the target to x64 or x86, then the browser displays as expected.
I notice in the Ourcode comments that user Edek Halon has had the same issue, but no solution seems to be provided. Edek, has the same setup as me, so I wonder if this is an issue in 53.0.1? Potentialy Joey De Vries in the comments has the same issue.
The addition of support for Any CPU in CefSharp is covered in this GitHub issue : https://github.com/cefsharp/CefSharp/issues/1714
There is a troubleshooting page for CefSharp (https://github.com/cefsharp/CefSharp/wiki/Trouble-Shooting) and it seems a bit contradictory. Under General Troubleshooting
1) Platform Target You must select either x86 or x64 when using the NuGet packages. If you select AnyCPU the NuGet magic won't work currently.
Does CefSharp need to be built from source for Any CPU to work?
Just if anyone is having difficulties with this, follow the Github Tutorial at the following link : https://github.com/cefsharp/CefSharp/issues/1714
Basically the code should be as follows (Winforms Example):
CefSharpSettings.SubprocessExitIfParentProcessClosed = true;
Cef.EnableHighDPISupport();
CefSettings settings = new CefSettings
{
CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache"), //By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
BrowserSubprocessPath = #"x86\CefSharp.BrowserSubprocess.exe"
};
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null); // Initialize cef with the provided settings
chromeBrowser = new ChromiumWebBrowser("http://ourcodeworld.com"); // Create a browser component
this.Controls.Add(chromeBrowser); // Add it to the form and fill it to the form window.
chromeBrowser.Dock = DockStyle.Fill;

System.Management.dll not recognised .Net 4.6

I am having a really wired issue where I have created a new ASP.Net 4.6 web application (Visual Studio 2015 Community Edition) and everything works fine.
The app will compile without any issues at all but as soon as I try to run the app on the development machine (Windows 10 Enterprise) I get the following error every time and I cannot figure out why?
BC30002: Type 'ConnectionOptions' is not defined.
The code I am using is as follows:
Dim Options As New ConnectionOptions()
Options.Username = HttpContext.Current.Application("WMIUser")
Options.Password = HttpContext.Current.Application("WMIPsssword")
Dim scope As New ManagementScope("\\" & server_name & "\root\cimv2", Options)
scope.Connect()
Dim objectQuery As New ObjectQuery("SELECT FreeSpace FROM Win32_LogicalDisk where DeviceID=""" + deviceId + ":""")
Dim objectSearcher As New ManagementObjectSearcher(scope, objectQuery)
Dim objectCollection As ManagementObjectCollection = objectSearcher.[Get]()
For Each m As ManagementObject In objectCollection
Dim FreeSpace As Double = Convert.ToDouble(m("FreeSpace"))
Next
I have a reference to the System.Management DLL in the references for the application and I have an Imports declaration for it also.
Has anyone come across this before? My searching all leads back to the DLL not being referenced in the application but I have added and removed and re-added without any change.
Please help this is driving me nuts :-(
OK so this is a funny one, posting up just in case someone else comes across the issue.
The way I resolved this problem on the development machine was under References for the project, you have the option to copy local, set this to true and rebuilt the application, ran it and hey presto it all worked.
I can only assume that this could be a permissions thing but this works for the moment anyway.
Hope this helps someone in the future.

ASP.NET using AtalaSoft to convert Tiff compression

Using Atalasoft's free SDK,
http://www.atalasoft.com/free-dotnet-image-sdk
I added reference to the DotImage and DotImage.Lib dlls' to Visual Studio 2010.
My code:-
Atalasoft.Imaging.AtalaImage image = new Atalasoft.Imaging.AtalaImage(fileName);
Atalasoft.Imaging.Codec.TiffEncoder encoder = new Atalasoft.Imaging.Codec.TiffEncoder();
encoder.Compression = Atalasoft.Imaging.Codec.TiffCompression.Group4FaxEncoding;
image.Save(fileName, encoder, null); // destroys the original.
However when I run the code I get an error on the very first line:-
Unable to retrieve security descriptor for this frame.
Can anyone help me out with this?
Update:-
I added a further line of code:-
System.Security.Permissions.FileIOPermission f2 = new System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.AllAccess, fileName);
Still the same error.
Philo,
Hi, I'm the support engineer you called in to yesterday. I apologize - after you called in, I received a note from our chief software architect asking us to help you out.
If you are still experiencing your issue, please do call back in and/or create a support case on our portal at https://www.atalasoft.com/support/my-portal/cases
A couple of tings that come to mind from your case: make sure you're targeting either x86 or x64 in your project's platform target (DotImage "has bitness") and make sure you're using the appropriate x86 or x64 Atalasoft references. (I strongly suggest our x86 while getting started as x64 has some additional hoops to jump through to get the licensing working.
Atalasoft does ship some AnyCPU dlls but they're for an extremely limited subset of use cases and if you have referenced those and/or are attempting to target your project to AnyCPU, this will cause all sorts of odd behavior.
Also, if you're targeting our .NET framework 4.0, make sure you're targeting the full framework and not "Client Profile" as DotImage has dependencies on components not present in the Client Profile version.
~DigitalSorceress
Did you have the the file with .lic extension in project section on the right side? Make sure about that.

Exception when using SQLite in WinRT app

I'm building a Windows 8 app, and now I want to use SQLite for this app. I installed SQLite for Windows Runtime through the Visual Studio 2013 extension manager, and I added sqlite-net to my project through NuGet.
I'm trying to create a database in my app.xaml.cs OnLaunched, but I get this exception when I run the project:
Unable to load DLL 'sqlite3': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
This is very strange because there is no error during compiling. Anyway, I think it tries to tell me that I need to reference an additional DLL: sqlite3.dll, but that doesn't work. I have 6 different DLLs on my file system: both debug and release versions of ARM, x64 and x86. I tried adding the x86 release version to my project but that results in this exception:
A reference to 'C:\Users\Leon\Documents\Visual Studio
2013\Projects\Googalytics\packages\SQLite\x86\sqlite3.dll' could not
be added. Please make sure that the file is accessible, and that it is
a valid assembly or COM component.
It's very sad that the documentation for sqlite-net sucks, it's very outdated (examples don't even work anymore), it's very incomplete and there is no mention of manually adding a DLL either. So I have 2 questions:
How do I fix this particular issue?
Where do I find up to date documentation for sqlite-net?
Edit: the code I use to create the DB is:
private void InitializeDatabase()
{
var db = new SQLiteConnection("Googalytics");
db.CreateTable<Account>();
db.CreateTable<WebProperty>();
db.CreateTable<Profile>();
}
I call that method from here:
InitializeDatabase();
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
{
throw new Exception("Failed to create initial page");
}
}
// Ensure the current window is active
Window.Current.Activate();
edit2: some more info about my setup:
Visual Studio 2013 RC
Windows 8.1 RTM
SQLite for Windows Runtime 3.8.0.2
sqlite-net 1.0.7
Your project has its build mode currently set to Any CPU, what is the default. Because the SqLite assembly is not build as AnyCPU you need to set your build mode to X86 and add the X86 SqLite reference.
When deploying your app you also need to create 3 packages instead of 1 AnyCPU package.
Because your project is AnyCPU you get the error message when trying to add the x86, x86 is not valid for AnyCPU.
UPDATE
I tried to replicate your problem. I installed the SQLite for Windows Runtime for Visual Studio Ultimate 2012, after that I created a Windows Store Project, then added the SqLite reference after that I added sqlite-net and last I added your code for DB creation.
I modified the code a little bit (path & tables). But my code gives no error at all.
I did not need to reference the SqLite assemblies myself. Because by installing the extension into Visual Studio you get the reference in your extension list (still need to select it, just not add the dlls):
But still like I said in my first answer, you need to set your build mode to something else than 'Any CPU'
My example is on my skydrive (when testing set configuration to x86).
UPDATE 2
Db path:
var dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite");
var db = new SQLite.SQLiteConnection(dbPath);

Sys.WebForms.PageRequestManager.getInstance() not supporting in IE 10 and windows 8

I am facing some asp.net ajax problem in my application on IE 10 in windows 8. But it is running correctly in compatibility mode of IE 10.
You can see my live demo for this here, it works fine in all browser instead of IE 10 (also works fine in IE9 on windows 7).
Don't konw what is the reason?
on my page i am registering this event :-
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function() {
page_Load();
});
$().ready(function() { page_Load(); });
function page_Load() {
//my code for onload registration goes here(it all working fine)
}
Please help me.
Best Regards
Instead of Sys.WebForms.PageRequestManager.getInstance(); you can try jQuery .on() method.
Eg.:
$('html').on('click', '.selector', function () {
page_Load();
});
The server might not recognize Internet Explorer 10 as a web browser that supports JavaScripts. Running windows update fixed the problems for me.
If you cant update your server, you can try to add/modify your ie.browser in app_browser folder.
If you don't have access to the whole machine and/or just want to update a single project, use NuGet to install the App_BrowsersUpdate package. Your site structure in Solution Explorer will then look like the image at right. Note that NuGet uses .NET 4, so for systems that have only .NET 2, you'll need to get the ZIP file and put the new browser files in App_Browsers manually.
.NET 4 Browser Update NuGet Package - http://nuget.org/List/Packages/App_BrowsersUpdate
install-package App_BrowsersUpdate
.NET 2.0 Browser Update NuGet Package - http://nuget.org/List/Packages/App_BrowsersUpdate.net20
install-package App_BrowsersUpdate.net20
Note that NuGet is VS2010 specific so if you don't have nuget.exe and .NET 4, you can also copy the .NET 2 updated browser files into ~\App_Browsers manually from this zip file.
Updating the whole machine is the preferred way to fix this.
Quote source

Resources