Environment:
Mono 2.6.7
CentOS 5.4, 32-bit
I have a Gtk Window with various docking panels (MonoDevelop.Components.Docking). In a tabbed group of panels, one panel crashes the application with a SIGSEGV in a very specific situation:
click on another tab to view a panel other than this one in the tabbed group
click back to the problem panel
move mouse around over the first row of the TreeView displayed in the panel
this only occurs if there is at least one row with data, and only when moving the mouse around over the first row of data
Here is the stack trace when the app crashes:
Stacktrace:
at (wrapper managed-to-native) Gtk.Application.gtk_main () <0x00004>
at (wrapper managed-to-native) Gtk.Application.gtk_main () <0x00004>
at Gtk.Application.Run () <0x0000a>
at MyApp.MainClass.Main (string[]) <0x002ad>
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0x00043>
Native stacktrace:
mono [0x80d93bb]
mono [0x8114180]
[0xdb6440]
/mydir/deps/lib/libcairo.so.2 [0x1f47178]
/mydir/deps/lib/libcairo.so.2 [0x1f432e0]
/mydir/deps/lib/libcairo.so.2 [0x1f4354d]
/mydir/deps/lib/libcairo.so.2 [0x1f17396]
/mydir/deps/lib/libcairo.so.2 [0x1f1989d]
/mydir/deps/lib/libcairo.so.2 [0x1f19cc1]
/mydir/deps/lib/libcairo.so.2 [0x1f164e6]
/mydir/deps/lib/libcairo.so.2 [0x1f06cb3]
/mydir/deps/lib/libcairo.so.2(cairo_fill_preserve+0x2c) [0x1eff00c]
/mydir/deps/lib/libcairo.so.2(cairo_fill+0x12) [0x1eff032]
/mydir/deps/lib/libgtk-x11-2.0.so.0 [0x345cc16]
/mydir/deps/lib/libgtk-x11-2.0.so.0(gtk_cell_renderer_render+0x92) [0x34596b2]
/mydir/deps/lib/libgtk-x11-2.0.so.0 [0x363594d]
/mydir/deps/lib/libgtk-x11-2.0.so.0 [0x3636689]
/mydir/deps/lib/libgtk-x11-2.0.so.0 [0x3632e88]
/mydir/deps/lib/libgtk-x11-2.0.so.0 [0x352804e]
/mydir/deps/lib/libgobject-2.0.so.0 [0x1ec5729]
/mydir/deps/lib/libgobject-2.0.so.0(g_closure_invoke+0x123) [0x1ec6f33]
/mydir/deps/lib/libgobject-2.0.so.0 [0x1ed80c1]
/mydir/deps/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x68f) [0x1ed8d7f]
/mydir/deps/lib/libgobject-2.0.so.0(g_signal_emit+0x29) [0x1ed9179]
/mydir/deps/lib/libgtk-x11-2.0.so.0 [0x3645f78]
/mydir/deps/lib/libgtk-x11-2.0.so.0(gtk_main_do_event+0x507) [0x35225e7]
/mydir/deps/lib/libgdk-x11-2.0.so.0 [0xcfb38b]
/mydir/deps/lib/libgdk-x11-2.0.so.0(gdk_window_process_all_updates+0xf8) [0xcfba38]
/mydir/deps/lib/libgdk-x11-2.0.so.0 [0xcfba5b]
/mydir/deps/lib/libgdk-x11-2.0.so.0 [0xce1a18]
/mydir/deps/lib/libglib-2.0.so.0 [0x26ba01]
/mydir/deps/lib/libglib-2.0.so.0(g_main_context_dispatch+0x17c) [0x26d5bc]
/mydir/deps/lib/libglib-2.0.so.0 [0x270a26]
/mydir/deps/lib/libglib-2.0.so.0(g_main_loop_run+0x1a9) [0x270dd9]
/mydir/deps/lib/libgtk-x11-2.0.so.0(gtk_main+0xb4) [0x3522844]
[0x609524e]
[0x6095213]
[0xcc0766]
[0xd5e88c]
mono [0x8062076]
mono(mono_runtime_invoke+0x40) [0x8158b20]
mono(mono_runtime_exec_main+0xea) [0x815ed0a]
mono(mono_runtime_run_main+0x1ba) [0x81602fa]
mono(mono_main+0x1670) [0x80b5f80]
mono [0x80594a1]
/lib/libc.so.6(__libc_start_main+0xdc) [0x49ee9c]
mono(g_ascii_strcasecmp+0x95) [0x80593b1]
Debug info from gdb:
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
It's difficult to give any code since it's proprietary to my employer, and it's pretty messy code. I was just wondering if anyone had some tips on some general cases that might cause this that I could look for.
Also, please do not just reply with "use a later version of Mono", etc. This is the environment I'm given to work with. If there is some Mono bug related to this though, that would be helpful info.
Note that I did find a question here: MonoTouch NullReference for every event/Action (SIGSEGV),
that mentions local UI components with attached events getting disposed. I did a search in my code and the only local UI components with events are 2 popup menu items. However, the code is not being hit in this situation because I'm not triggering the menu (right-click).
Thank you.
Mono 2.6.7 is kind of old, can you test with stable Mono 2.10.6?
You said "please do not just reply with "use a later version of Mono" but I just don't see how you don't go down that route. Perhaps the crashes are coming from GtkSharp being out of date and buggy, perhaps it's Mono. We just don't know what is causing it given the error posted.
With that said, I'd write up a test case with the UI on a single window and then try to isolate the problem outside of the proprietary app. This way if the problem is still occurring you can post code here that will be easier for people to pinpoint a problem or even assist in bug filing against Mono or GtkSharp, etc..
The problem happened to be a bug in the cairo package we were using. We upgraded to a newer version - problem solved. The bug had to do with rendering pixbufs in the cells.
To the other 2 posts, yes using a newer version of Mono would be great. However, we are working under time/money constraints while supporting legacy projects. Hopefully we'll have an effort to upgrade Mono and test everything next year.
Related
The problem has already been discussed earlier, but I got it after the update in September. Environment: the latest vs studio for mac, all the frameworks are updated, I also tried to switch to the preview channel, the error is the same. Actually the problem: after the update, the error of creating a native object began to appear.
From my renderer to - at Foundation.NSObject.InitializeObject (System.Boolean alloced) [0x0002e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.8.2.2/src/Xamarin.iOS/Foundation/NSObject2.cs:196 at Foundation.NSObject..ctor (Foundation.NSObjectFlag x) [0x0000d] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.8.2.2/src/Xamarin.iOS/Foundation/NSObject2.cs:131 at UIKit.UIResponder..ctor (Foundation.NSObjectFlag t) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.8.2.2/src/Xamarin.iOS/UIResponder.g.cs:69 at UIKit.UIView..ctor (Foundation.NSObjectFlag t) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.8.2.2/src/Xamarin.iOS/UIView.g.cs:83
Error message: Could not create an native instance of the type 'xxx': the native class hasn't been loaded. It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.
if set ObjCRuntime.Class.ThrowOnInitFailure = false; - native constructor returns null;
lib in Binding project is fat, all architectures are supported. i have no its code, only headers. ApiDefinition and Structs generated by sharpie, and works well.
mtouch options: --optimize=-remove-dynamic-registrar
please give some ways to solve, project is on fire..
If exist way to rollback all mono frameworks i can try, but its not good way.
I develop a little test to study C# and GTK. In linux, this works perfectly, but when I try to run this in windows never works. The project is a simple calc.
In these windows I install:
dotNetx45_Full
gtk2runtime-2.24.10-2012-10-10
gtk-sharp-2.12.45
At this moment when I run in windows the feedback in windows events is:
Application: Calculadora.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Information: System.DllNotFoundException
Stack:
in GLib.Object.gtksharp_register_type (IntPtr, IntPtr)
in GLib.Object.RegisterGType (System.Type)
in GLib.Object.LookupGType (System.Type)
in GLib.Object.LookupGType ()
in GLib.Object.CreateNativeObject (IntPtr [], GLib.Value [], Int32)
in Gtk.Window..ctor (Gtk.WindowType)
in Calculator.MainClass.Main (System.String [])
Thanks for all help!
That is odd. Gtk# says it targets gnome 2.20. It may be that you have some conflict between the versions in Gtk# and those in the Gtk2 runtime which look newer (2.24). I believe you should not need this runtime as the Gtk# installer should come with a runtime. It looks like the version of glib being loaded at runtime knows nothing about IntPtr. Could you have downloaded the mono version of gtk# rather than the .Net version? Try https://dl.xamarin.com/GTKforWindows/Windows/gtk-sharp-2.12.45.msi
First post. Let me know if I break any rules!
I would like to experiment with Pure Data and Unity 5. It seems uPD would be the best fit. I have followed the instructions on the github page and loaded the first sample scene. The unity console reports errors with the dll:
Failed to load 'Assets/Magicolo/AudioTools/PureData/Plugins/libpdcsharp.dll', expected 64 bit architecture (IMAGE_FILE_MACHINE_AMD64), but was IMAGE_FILE_MACHINE_I386. You must recompile your plugin for 64 bit architecture.
So I cloned the main libpd repo and used the included batch file to build an x64 dll. I replaced the libpdcsharp.dll in the unity project and the console now reports:
DllNotFoundException: Assets/Magicolo/AudioTools/PureData/Plugins/libpdcsharp.dll
LibPDBinding.LibPD.ProcessArgs[Int32] (System.Int32[] args, System.String& debug) (at Assets/Magicolo/AudioTools/PureData/LibPD/LibPDNativeMessaging.cs:402)
LibPDBinding.LibPD.SendMessage[Int32] (System.String receiver, System.String message, System.Int32[] args) (at Assets/Magicolo/AudioTools/PureData/LibPD/LibPDNativeMessaging.cs:354)
(wrapper synchronized) LibPDBinding.LibPD:SendMessage (string,string,int[])
LibPDBinding.LibPD.ComputeAudio (Boolean state) (at Assets/Magicolo/AudioTools/PureData/LibPD/LibPDNativeMethods.cs:238)
(wrapper synchronized) LibPDBinding.LibPD:ComputeAudio (bool)
LibPDBinding.LibPD.Release () (at Assets/Magicolo/AudioTools/PureData/LibPD/LibPDNativeMethods.cs:207)
(wrapper synchronized) LibPDBinding.LibPD:Release ()
LibPDBinding.LibPD.ReInit () (at Assets/Magicolo/AudioTools/PureData/LibPD/LibPDNativeMethods.cs:79)
(wrapper synchronized) LibPDBinding.LibPD:ReInit ()
LibPDBinding.LibPD..cctor () (at Assets/Magicolo/AudioTools/PureData/LibPD/LibPDNativeMethods.cs:65)
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for LibPDBinding.LibPD
Magicolo.AudioTools.PureDataBridge.SetAudioSettings () (at Assets/Magicolo/AudioTools/PureData/PureDataBridge.cs:46)
Magicolo.AudioTools.PureDataBridge.StartLibPD () (at Assets/Magicolo/AudioTools/PureData/PureDataBridge.cs:25)
Magicolo.AudioTools.PureDataBridge.Start () (at Assets/Magicolo/AudioTools/PureData/PureDataBridge.cs:50)
PureData.StartAll () (at Assets/Magicolo/AudioTools/PureData/PureData.cs:141)
PureData.Initialize () (at Assets/Magicolo/AudioTools/PureData/PureData.cs:58)
PureData.Awake () (at Assets/Magicolo/AudioTools/PureData/PureData.cs:173)
I have also tried copying the libPDBinding.dll file from the main libpd repo to the unity project no avail. I lack the understanding to know where to go next so any help at all would be appreciated!
Further Progress
It was suggested to try NuGet to obtain the binding dll. On this - I get an error about a framework mismatch between my unity project/visual studio solution and the nuget package libPDBinding version 0.10.0. This is to do with unitys profiles as described in an article titled: "Using NuGet in Visual Studio Tools for Unity". I cant post the link here because I am too new.
However, I think I am sucessful in compiling my own libPDBinding.dll. Apologies for dragging this out, just making sure I am doing this right:
After using libPD\mingw64_build_csharp.bat to compile a x64 version of libpdcsharp.dll, I reference this and libpd\libs\mingw64\libwinthread-1.dll in the VS solution and get the resulting LibPDBinding.dll which was built with .NET 3.5. As mentioned libpdcsharp.dll was compiled using the batch/make file, so am I correct to assume this file has been built with the correct settings?
I proceed to copy these 3 dll's the unity assets folder
For reference it's a blank unity project with uPD as the only package, loaded to a uPD example scene.
I still get some errors at run time and some visual studio warnings as follows.
Unity run time error:
EntryPointNotFoundException: libpd_safe_init
LibPDBinding.LibPD.ReInit () (at Assets/Magicolo/AudioTools/PureData/LibPD/LibPDNativeMethods.cs:81)
(wrapper synchronized) LibPDBinding.LibPD:ReInit ()
LibPDBinding.LibPD..cctor () (at Assets/Magicolo/AudioTools/PureData/LibPD/LibPDNativeMethods.cs:65)
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for LibPDBinding.LibPD
Magicolo.AudioTools.PureDataBridge.SetAudioSettings () (at Assets/Magicolo/AudioTools/PureData/PureDataBridge.cs:46)
Magicolo.AudioTools.PureDataBridge.StartLibPD () (at Assets/Magicolo/AudioTools/PureData/PureDataBridge.cs:25)
Magicolo.AudioTools.PureDataBridge.Start () (at Assets/Magicolo/AudioTools/PureData/PureDataBridge.cs:50)
PureData.StartAll () (at Assets/Magicolo/AudioTools/PureData/PureData.cs:141)
PureData.Initialize () (at Assets/Magicolo/AudioTools/PureData/PureData.cs:58)
PureData.Awake () (at Assets/Magicolo/AudioTools/PureData/PureData.cs:173)
Visual studio warnings x 50 or so:
Warning CS0436 The type 'LibPD' in 'D:\unity projects\libpdinunity\Assets\Magicolo\AudioTools\PureData\LibPD\LibPdNativeUnity.cs' conflicts with the imported type 'LibPD' in 'LibPDBinding, Version=0.3.0.177, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\unity projects\libpdinunity\Assets\Magicolo\AudioTools\PureData\LibPD\LibPdNativeUnity.cs'. libpdinunity.CSharp D:\unity projects\libpdinunity\Assets\Magicolo\AudioTools\PureData\PureDataCommunicator.cs 87 Active
Thanks again for any help. Much appreciated.
Looking at your error, libpdcsharp is currently placed at <ProjectDirectory>/Assets/Magicolo/AudioTools/PureData/Plugins/
This DLL file should be placed at <ProjectDirectory>/Asset.
Also, make sure that libpdcsharp is compiled with .NET 2.0 or 3.5. This won't work if you compile it with .NET 4.0 and above.
I am the maintainer of C# binding for LibPD.
You also need to change the link to the correct libwinpthread-1.dll version (64 bit instead of 32). In your final project you need all 3 dlls:
LibPDBinding.dll (the managed wrapper)
libpdcsharp.dll (the native dll)
libwinpthread-1.dll (for enabling POSIX threads on Windows)
Also: Have you tried the version from NuGet? No need to compile your own version of the binding.
EDIT: Your warning are from a different source: You have two classes named LibPD, and the C# compiler does not know, which one to use.
I am not sure, if these types are in the same namespace.
If they are in the same namespace, then change your namespace.
If they are in different namespaces, add a line using LibPd = LibPDBinding.LibPD; if you want to use the version from NuGet, or using LibPd = <yournamespace>.LibPD; if you want to use your version.
It's working. The uPD github code has an error as far as I can tell. So hopefully it gets fixed. In the meantime I just started the process from scratch and this is what I did to get the uPD test scene working in unity 5:
Get uPD from github. Theres a unity package in there
Get libPD from github.
Follow the instructions on the libPD github page to compile a x64
vresion of libpdcsharp.dll
replace the existing libpdcsharp.dll inside your unity project with
the x64 version you compiled
locate libpd\libs\mingw64\libwinthread-1.dll in the libpd files and
place this in the your unity project - the same place as the other dll is fine. I
don't think it matters where you put the Dll's (at least it made no
difference in my tests)
Run the project and notice you get an error in unity EntryPointNotFoundException: libpd_safe_init
double click the error to open up the problem script.
Find the following line of code: [DllImport("libpdcsharp", EntryPoint="libpd_safe_init")]
Change it to [DllImport("libpdcsharp", EntryPoint="libpd_init")] That's the real entry point for the init function in libpdcsharp. I don't know what libpd_safe_init is.
Thanks to the contributors who helped me to troubleshoot and find the issue!
I have a similar problem to this question C# windows appication Event: CLR20r3 on application start
The error is like this:
Application: MantenedorPlanesMain.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
Battery:
in CefSharp.Example.CefExample.Init ()
in CefSharp.WinForms.Example.Program.Main ()
But only on some machines, for example, on my computer I can use the program without any problem and in a computer of my office too.
I tried to find the source of the problem here in stackoverflow and realized that the error was caused by a cs file not found, but is within the project.
When I go to see CefSharp.WinForms.Example.Program.cs and comment the line of CefSharp.Example.CefExample.Init() throws me the same error in another file.
I tried everything, even the CopyLocal = true and x86, but still not working. I think there may be a problem with the system language, which is the only common factor of the machines that worked, Spanish language system.
any ideas?
In this context FileNotFoundException usually means you need to install VC++ or that you compiled in Debug mode (You need to build in Release mode when running on a machine without VS installed)
https://github.com/cefsharp/CefSharp/blob/master/NuGet/Readme.txt#L18
Also See the Note within https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#6-how-do-i-include-the-visual-studio-c-2012-redistributables-on-the-target-app
I have developed a GTK# application that makes use of webkit-sharp to edit email templates. This application works in Linux but when it is run in Windows it does not work. I am using the webkit-sharp.dll from Linux in Windows. The error that I am getting is:
System.TypeInitializationException: The type initializer for 'WebKit.WebView' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'webkit-1.0': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at WebKit.Download.webkit_download_get_type()
at GtkSharp.WebkitSharp.ObjectManager.Initialize()
at WebKit.WebView..cctor()
--- End of inner exception stack trace ---
at WebKit.WebView..ctor()
at MainWindow..ctor()
I am guessing that webkit-sharp.dll only wraps the native libraries for WebKit. I do not know where to get "webkit-1.0". Is there a webkit-sharp.dll that is specific to Windows for GTK#?
I did exactly that. I guess the webkit windows dll does not use gtk as rendering engine.
What I did was install the libwebkit dll provided by the suse mingw32 port and all of its dependencies.
You can see a full list of dependencies here
At the time of doing it(1 year ago more or less) the rendering was not perfect, but it may have improved.
I'm also having this problem...
Not tried this, but at http://www.webkit.org/building/checkout.html
The site suggests:
Download webkit support libraries
Run the update-webkit script
Build webkit from source
I think this requires cygwin installed.
I'm just paraphrasing the site - not tried this yet.
Have you tried running the Hello World example app to make sure everything is set up correctly in your Windows environment?
http://mono-project.com/Mono_Basics
You can also try some of the other example programs to make sure they function without error.
http://www.mono-project.com/GtkSharpBeginnersGuide
Seems like a common installation issue requires the addition of an environment variable in windows to get the assemblies loaded correctly:
http://www.mono-project.com/FAQ:_General#Installation_Problems