Skip to content
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

The dependency of CefSharp #519

Closed
qianlongzju opened this issue Oct 20, 2014 · 28 comments
Closed

The dependency of CefSharp #519

qianlongzju opened this issue Oct 20, 2014 · 28 comments

Comments

@qianlongzju
Copy link

Hi Guys,
I have successfully compiled the CefSharp.WinForms.Example and run the app. After that, I just copy the CefSharp.WinForms.Example\bin\x86\Debug folder to another machine which has .NET 4.0 installed. But the app could not run successfully again.
The debug information says:

An unhandled exception of type 'System.BadImageFormatException' occurred in CefSharp.WinForms.Example.exe

Additional information: Could not load file or assembly 'CefSharp.Core.dll' or one of its dependencies. >is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

I have used Dependency Walker to search for missing dll for CefSharp.Core.dll, and added msvcp120d.dll and msvcr120d.dll. When I rerun the app, I still encounter the same problem.

So, I really want to know what the other dependencies are, which can help me package my app.

@jornh
Copy link
Contributor

jornh commented Oct 20, 2014

First obvious problem is that CefSharp.Core.dll delivered through NuGet which CefSharp.WinForms.Example use is built using VS 2012, as mentioned in the FAQ - so the dependencies should be msvc*110*.dll - also make sure your own project is set to x86 not e.g. AnyCPU.

Finally I suggest you use NuGet to install CefSharp into your project. If you start by creating a fresh x86 project NuGet should take care of copying all dependencies to your bin/ folder (apart from VCRedist 2012)

@qianlongzju
Copy link
Author

@jornh Yeah, I have used NuGet to install CefSharp. And all the thing is fine.
But I am now focusing on packaging my application, and try to install on other machines, So I want to know the detail dependencies.
And should the dependencies be msvc*110*.dll? Or are msvc*100*.dll ok? I see my target machine have msvc*100*.dll, but not work, so I am trying msvc*110*.dll.
I really don't know much about those dll things. Please let me know if I have any misunderstanding.

@qianlongzju
Copy link
Author

@jornh I have added all msvc*100*.dll and msvc*110*.dll and msvc*120*.dll, still can not run the app in my target machine.

@amaitland
Copy link
Member

@jornh
Copy link
Contributor

jornh commented Oct 20, 2014

You said

An unhandled exception of type 'System.BadImageFormatException' occurred in CefSharp.WinForms.Example.exe

I think Google/ and Stack Owerflow in particular is your friend: http://stackoverflow.com/a/18625875/210723

@qianlongzju
Copy link
Author

I installed Visual C++ Redistributable Packages for Visual Studio 2013 (http://www.microsoft.com/en-us/download/confirmation.aspx?id=40784) and it didnot work.
But if I install vs2013 on my target machine, the app can run.

@amaitland
Copy link
Member

I installed Visual C++ Redistributable Packages for Visual Studio 2013 (http://www.microsoft.com/en-us/download/confirmation.aspx?id=40784) and it didnot work.

Did you read the FAQ article I linked to above?

@qianlongzju
Copy link
Author

yeah,i have copied the dll files under the directory in your link

@amaitland
Copy link
Member

I installed Visual C++ Redistributable Packages for Visual Studio 2013 (http://www.microsoft.com/en-us/download/confirmation.aspx?id=40784) and it didnot work.

Is there a reason you installed 2013 rather than 2012?

Latest version of 2012 at time of writing is here http://www.microsoft.com/en-us/download/details.aspx?id=30679

@jornh
Copy link
Contributor

jornh commented Oct 20, 2014

Ah, I think that might point to either:

Oh, and

(http://www.microsoft.com/en-us/download/confirmation.aspx?id=40784)

certainly won't do it .. it's vcredist_arm.exe! I think we might need to clarify this in the FAQ 😝

Update yes of course @amaitland is right - you also need it to be 2012, not the link I gave!

@peters
Copy link
Contributor

peters commented Oct 20, 2014

Its no wonder you cannot run cefsharp on a target machine when you compile
in debug mode. This requires the debug version of the redist. Thats why it
works when you install visual studio on the target machine. Copy msvcr120d,
msvcp120d and you are good to go. Please take note that these two files
ends with a 'd'.

On Monday, October 20, 2014, Alex Maitland notifications@github.com wrote:

I installed Visual C++ Redistributable Packages for Visual Studio 2013 (
http://www.microsoft.com/en-us/download/confirmation.aspx?id=40784) and
it didnot work.

Did you read the FAQ article I linked to above?


Reply to this email directly or view it on GitHub
#519 (comment).

Regards,
Peter Sunde.

@amaitland
Copy link
Member

(VCRedist only is for release)

Should probably add that to the FAQ, might be relevant for those building from source.

Or that you must install the x86 version of VCRedist when you build for x86

I guess we should include some info about x86 and x64 in the FAQ as well.

@jornh
Copy link
Contributor

jornh commented Oct 20, 2014

@peters yes, that would be true if the CefSharp dll's came from a source build with debug from a VS2013.

As @jessicasco uses the release ones (from I hope 33.<something> which is release) it need to be like the FAQ says VCRedist 2012 - with the extra addition that you need x86 - even for a VS2013 application build.... Oh boy, I 🙏 that all this really is right (otherwise please forgive and then correct me ;)

I guess we need to draw a real simple picture with the dependencies and why, because it will haunt us from now on, with x64 now in the mix too this wont get easier 😧

@jornh
Copy link
Contributor

jornh commented Oct 22, 2014

@jessicasco did you get it working?

@qianlongzju
Copy link
Author

@jornh yeah, it's working now. I compiled it under Debug mode, so vcredist didn't help. I can run it if compiled under Release mode.

@jornh
Copy link
Contributor

jornh commented Oct 22, 2014

Great! Then please go ahead and close this issue so it's nice and tidy in here 👍

@qianlongzju
Copy link
Author

Hi guys, I still found that the app didn't function normally. Is there something needed to do about CefSharp.BrowserSubprocess.exe? One of my app can startup, but show blank page, and the other app crashed when starting up and show that CefSharp.BrowserSubprosses has stoped working

Additional information: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:CallMethodResult. The InnerException message was 'There was an error deserializing the object of type CefSharp.Internals.BrowserProcessResponse. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.'. Please see InnerException for more details.

@qianlongzju
Copy link
Author

ps. The exception is An unhandled exception of type 'System.ServiceModel.Dispatcher.NetDispatcherFaultException' occurred in mscorlib.dll

@qianlongzju qianlongzju reopened this Oct 31, 2014
@amaitland
Copy link
Member

The maximum string content length quota (8192) has been exceeded while reading XML data

Are you executing Javascript at some point in your application?

@qianlongzju
Copy link
Author

@amaitland yeah, I am executing Javascript at some point. Also I found that
on my target machine the ·CefSharp.WinForms.Exampe exe· can start up but can not load pages.

@amaitland
Copy link
Member

I'd say you have two separate issues.

  • The javascript your executing is returning a result larger than 8192, easiest way to fix this is to move onto the JsBinding_Wip branch, or the 33.1.0-pre01 nuget package
  • Your machine isn't configured correctly or your build is incomplete. Confirm you copied all the files correctly when you deployed the CefSharp.WinForms.Example

@qianlongzju
Copy link
Author

@amaitland
For issue 1, the current branch I am using is JsBinding_Wip.
For issue 2, I have installed .NET 4.0 and vcredist, and copied all the files under bin.

@amaitland
Copy link
Member

For issue 1, the current branch I am using is JsBinding_Wip

Do you have a code sample?

@qianlongzju
Copy link
Author

@amaitland
I tried that: compile CefSharp.WinForms.Example project, copy and paste CefSharp\CefSharp.WinForms.Example\bin\x64\Release to another location in the same machine, run CefSharp.WinForms.Example.exe and I cannot load pages. Can you check this on your machine?

@jornh
Copy link
Contributor

jornh commented Nov 4, 2014

I don't think https://github.com/cefsharp/CefSharp/blob/v33.1.0-pre01/CefSharp.Example/CefExample.cs#L11 does blend very well with:

compile CefSharp.WinForms.Example project, copy and paste CefSharp\CefSharp.WinForms.Example\bin\x64\Release to another location in the same machine, run CefSharp.WinForms.Example.exe and I cannot load pages.

Note what expectations it sets up for where the BrowserSubprocess should live. Not very obvious 😧

@amaitland
Copy link
Member

I don't think https://github.com/cefsharp/CefSharp/blob/v33.1.0-pre01/CefSharp.Example/CefExample.cs#L11 does blend very well with:

Nice spot @jornh I've just committed a small change which hopefully is workable 9380f8f

@qianlongzju
Copy link
Author

@jornh @amaitland I got things right now, thank you for your help. Also, I found that if I use functionality of RegisterJsObject, I need to install .Net 4.5.1. If not BrowserSubprocess.exe will crash and report something wrong on kernelbase.dll

@amaitland
Copy link
Member

I need to install .Net 4.5.1. If not BrowserSubprocess.exe will crash and report something wrong on kernelbase.dll

@jessicasco As I don't have a machine with .Net 4.0 are you able to provide more detail on the problem? If you've got time, please open a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants