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

ole idispatch exception code 0 from fpdotnet unable to cast object from fpDotNet #20

Open
mdurfee opened this issue Sep 29, 2022 · 9 comments

Comments

@mdurfee
Copy link

mdurfee commented Sep 29, 2022

Here is a screenshot of the issue I am encountering.

ole_issue

I have tried unregistering and re-registering the fpDotNet.dll without any success.

I have also tried setting lCheckRuntime = .F. in cefsharpbrowser.prg.

I have verified that lcRuntime = This.GetInstalledVcRuntime (m.toHost) evaluates to "vc2019"

I tried this on two different systems.

Any and all help is greatly appreciated!

@dsdsdfsdfsfsdfsfsdf
Copy link

dsdsdfsdfsfsdfsfsdf commented Oct 15, 2022

The error is that the m.loChromium object is NULL or corrupted.
How was fpDotNet.dll unregistered?
Regasm.exe must be used for unregistering - example: %WINDIR%\Microsoft.NET\Framework\v4.0.30319\regasm.exe /unregister /codebase fpDotNet.dll /tlb fpDotNet.tlb
When registering fpDotNet.dll, the file fpDotNet.tlb and wwDotNetBridge.dll must also be in the same directory.

@mdurfee
Copy link
Author

mdurfee commented Oct 15, 2022

I followed the instructions exactly as described, with the same error after un-registering and re-registering the .dll.

All files are in the directory when I register the objects via regasm.exe

Here is the message I receive when I register the .dll:

RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.
Types registered successfully
Assembly exported to 'C:\fpDotNet\fpDotNet.tlb', and the type library was registered successfully

@dsdsdfsdfsfsdfsfsdf
Copy link

dsdsdfsdfsfsdfsfsdf commented Oct 16, 2022

I followed the instructions exactly as described, with the same error after un-registering and re-registering the .dll.

All files are in the directory when I register the objects via regasm.exe

Here is the message I receive when I register the .dll:

RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it. Types registered successfully Assembly exported to 'C:\fpDotNet\fpDotNet.tlb', and the type library was registered successfully

Your DLL library registration is OK. What value/type does the m.loChromium variable have? There may be a problem when creating the m.loChromium object and also possibly in the compatibility settings of Visual Foxpro vs. Windows. What version of Windows and Framework are you using? Please restart your Computer.

@mdurfee
Copy link
Author

mdurfee commented Oct 16, 2022

The value it is returning is a .NULL. value.

I am using windows 10, Foxpro 9 sp2.

@dsdsdfsdfsfsdfsfsdf
Copy link

dsdsdfsdfsfsdfsfsdf commented Oct 16, 2022

The value it is returning is a .NULL. value.

I am using windows 10, Foxpro 9 sp2.

Start debugging in VFP9 on the line:
loChromium = loBridge.CreateInstance("CefSharp.WinForms.ChromiumWebBrowser",m.lcAddress,NULL)
and see where it is set to NULL.

@mdurfee
Copy link
Author

mdurfee commented Oct 17, 2022

Debugging shows the following:

FUNCTION CreateInstance(lcClass,lvParm1, lvParm2, lvParm3, lvParm4, lvParm5)
     ...

CASE lnParmCount = 3
        loObject = loBridge.CreateInstance_TwoParms(lcClass,lvParm1, lvParm2)

loObject is NULL in this case.

The loBridge.ErrorMessage is "Constructor on type 'CefSharp.WinForms.ChromiumWebBrowser' not found."

@dsdsdfsdfsfsdfsfsdf
Copy link

Your problem is probably with the version of Cefsharp you are using. Please download the latest version of Cefsharp https://github.com/cwollenhaupt/fpCefSharp/releases/download/v97.1.61/fpCefSharp.v97.1.61.zip and then restore all files from directory \cef-bin-v97.1.61
After download the fpCefSharp.v97.1.61.zip file, don't forget to unblock the downloaded fpCefSharp.v97.1.61.zip file.

@cwollenhaupt
Copy link
Owner

There have been many changes in the v97.1.61.1 release regarding the handling of return values... Please try the latest release. If this doesn't work, please check what loBridge.cErrorMsg is.

This error usually means that something happened loading the assembly. wwDotNetBridge returns a NULL value that is converted to System.DBNull through the COM InterOp layer. In other words, usually the error is something completely different like permissions on the cef-bin folder, a version conflict, or something like this.

@JoelLeach
Copy link

I struggled with this error for a while when trying to run the ShowHtml demo form directly. I dug into the CefSharp code before I realized no URL was being passed in. That passed .F. as the URL, for which no matching constructor could be found, hence the error: "Constructor on type 'CefSharp.WinForms.ChromiumWebBrowser' not found." I should have been running the demo PRGs instead.

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

No branches or pull requests

4 participants