CefGlue Mono NullReference exception

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

CefGlue Mono NullReference exception

Postby ElterRitter » Tue Mar 16, 2021 4:39 am

I have an issue with .NET managed exceptions when working with Cef Glue on my Linux system (Debian 9.0) with mono. I have changed some code to make Cef Glue GTK# Demo work. Unfortunatelly, I use some old CEF releases (the latest that could work for me is 3359). Everything works fine, but since CefRuntime.Initialize() returns 1, any casual NullReferenceException (in any thread) leads my application to failure. This means, I cannot handle the following exception:
Code: Select all
try
{
    object o = null;
    o.ToString();
}
catch (Exception e)
{
    Console.WriteLine(e.Message); // this output will not be written
}

Instead, my program will abort with Segmentation fault evaluating "o.ToString()".

This is my environment:

Debian 9.0
Mono 6.4.0.198 (also tried on 4.8.1)
CefGlue from tag 3359 (also tried 3029 and 3163)

Do you have any ideas, why such behavior is possible?
ElterRitter
Newbie
 
Posts: 3
Joined: Fri Jul 12, 2019 9:06 am

Re: CefGlue Mono NullReference exception

Postby fddima » Tue Mar 16, 2021 7:16 am

Hello.

CefRuntime.Initialize() calls chromium's code, which non-conditionally will set various global handlers (for crash handling setup).

Somewhere I'm already discuss about, but did not remember where it was exactly.... so it is most likely override mono's exception handling handlers.

You should be fine if do:
1. Get handler
2. CefRuntime.Initialize()
3. Restore handler

Note, that, this is platform dependent. For example, on windows you rarely need care about something similar.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: CefGlue Mono NullReference exception

Postby fddima » Tue Mar 16, 2021 9:48 am

ElterRitter wrote:Do you have any ideas, why such behavior is possible?


Please, read this issue: https://gitlab.com/xiliumhq/chromiumemb ... /issues/29 it actually holds one of possible solution.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: CefGlue Mono NullReference exception

Postby ElterRitter » Tue Mar 16, 2021 12:05 pm

fddima wrote:
ElterRitter wrote:Do you have any ideas, why such behavior is possible?


Please, read this issue: https://gitlab.com/xiliumhq/chromiumemb ... /issues/29 it actually holds one of possible solution.


Super! Many thank's for this link!
ElterRitter
Newbie
 
Posts: 3
Joined: Fri Jul 12, 2019 9:06 am


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 14 guests