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

System.NullReferenceException Accessing Registered C# Object #1782

Closed
Jamie-Wallace opened this issue Aug 25, 2016 · 5 comments
Closed

System.NullReferenceException Accessing Registered C# Object #1782

Jamie-Wallace opened this issue Aug 25, 2016 · 5 comments

Comments

@Jamie-Wallace
Copy link

Jamie-Wallace commented Aug 25, 2016

We have a client experiencing a System.NullReferenceException:

exception

This is isolated to 1 machine and isn't repeatable on any other machine at their company, or on any of our dev machines.

We are getting a bit stuck for ideas on possible causes and looking for some ideas to at least replicate the issue.

Based on the exception stack have you any suggestions?

It looks like the exception is occurring the first ever time the JS attempts to access a C# object registered via RegisterJsObject.

Currently suspect the way that the C# classes are registered and accessed.

A developer has created a demo app - which exhibits the same problem for the client.

This file contains the C# class being registered and the code to register it:

http://pastebin.com/s7HWZBBQ

And this contains the JavaScript accessing the C#:

http://pastebin.com/7LF54fFy

  • What version of the product are you using?
    Build of branch 51.0.0
  • What architecture x86 or x64?
    x64
  • On what operating system?
    Win7
  • Are you using WinForms, WPF or OffScreen?
    WinForms
  • What steps will reproduce the problem?

We are currently unable to reproduce the problem outside of a remote clients machine.

When they launch a demo app containing the code pasted above, the null reference exception occurs when trying to access the registered C# object. The exception can be seen in Dev Tools.

  • What is the expected output? What do you see instead?

No exception and the embedded browser loads correctly.

  • Please provide any additional information below.
    • A stack trace if available, any Exception information.
    • Does the cef log provide any relevant information?
      No - with verbose logging on we get very similar/almost identical results to those on a machine where everything works.

I've attached the log anyway:

- Any other background information that's relevant? Are you doing something out of the ordinary? 3rd party controls?
  • Client has disabled/removed all anti-virus
  • Client has successfully used the application on a different machine in their organisation.
  • **Does this problem also occur in the Cef TestApp:

No it doesn't.

@rlmcneary2
Copy link
Contributor

@JWallaceDev - issues are for problem reports and change requests only; please ask questions on Gitter. Suggest you register your objects before you add the CWB to your form.

@amaitland
Copy link
Member

Based on the exception stack have you any suggestions?

@JWallaceDev Have you tried opening the image you posted? It's too small for me to read, probably others as well. Ideally just post a plain text version.

Please no binary (zip, etc) links, fork the MinimalExample and push your changes to GitHub. (Alternatively use a code sharing service list Gist or Pastebin).

No zip files please (quite clearly outlined in the issue template). https://github.com/cefsharp/CefSharp/blob/master/ISSUE_TEMPLATE.md#bug-report

Based on the amount of information you've provided and no way to reproduce the problem there isn't much to go on here. You maybe experiencing something like #915

Personally I'd be migrating to the async version.

@Jamie-Wallace
Copy link
Author

Appreciate the image is only just about legible but that's all I have from the client and I'm trying to keep hassling them down to a minimum. Zip was only way I could see for adding the log text file - sorry about that.

Thank you for the suggestions, I will try them out and move over to Gitter if needed.

@Jamie-Wallace
Copy link
Author

Closing and moving to Gitter if needed.

@Jamie-Wallace
Copy link
Author

Just a courtesy message to let you know that changing the diagnostics app to be async has fixed the problem and we will be working to migrate our main app.

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

3 participants