Bug 14781 - Application crashes when FileSystemWatcher Changed event handler shows a form
Summary: Application crashes when FileSystemWatcher Changed event handler shows a form
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-09-16 14:35 UTC by mvassilev
Modified: 2016-04-16 08:38 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
The whole sln (5.52 KB, application/zip)
2013-09-16 14:35 UTC, mvassilev
Details

Description mvassilev 2013-09-16 14:35:09 UTC
Created attachment 4902 [details]
The whole sln

Hi guys, sorry if this is the wrong section.

I want my application to listen for an assembly change and I want to get a notification (using Gtk.MessageDialog) when the assembly is changed. So I am using the FileSystemWatcher but when the MessageDialog is invoked the application crashes.

This is the application code:

System.IO.FileSystemWatcher watcher = new System.IO.FileSystemWatcher();
watcher.Path = System.IO.Path.GetTempPath();
watcher.NotifyFilter = System.IO.NotifyFilters.CreationTime | System.IO.NotifyFilters.LastWrite;
watcher.EnableRaisingEvents = true;
// The app crashes no matter if the nxt line is commented or not
//watcher.SynchronizingObject = this as System.ComponentModel.ISynchronizeInvoke;

watcher.Changed += delegate(object sender, System.IO.FileSystemEventArgs e) {
  var msgBox = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, Gtk.MessageType.Info,
                                     Gtk.ButtonsType.Ok, "File Created in the temp");
  msgBox.Run();
  msgBox.Destroy();
};

And when the Gtk.MessageDialog is invoked the application crashes with the following:

Stacktrace:

  at (wrapper managed-to-native) Gtk.Application.gtk_main () <IL 0x0000e, 0xffffffff>
  at Gtk.Application.Run () <IL 0x00000, 0x0002f>
  at FileSystemWatcherTest.MainClass.Main (string[]) [0x00011] in /home/mvassilev/workspace/Experimental/FileSystemWatcherTest/FileSystemWatcherTest/Main.cs:13
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

Native stacktrace:

	/usr/bin/mono() [0x4916ba]
	/usr/bin/mono() [0x4e0d4f]
	/usr/bin/mono() [0x41bc77]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0) [0x7f6bdff6dcb0]
	/usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(gdk_window_set_geometry_hints+0x4) [0x7f6bda243054]
	/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0(+0x25fb63) [0x7f6bda6e6b63]
	/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(+0xfeca) [0x7f6bd8756eca]
	/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist+0x421) [0x7f6bd876f741]
	/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit+0x82) [0x7f6bd8770242]
	/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0(+0xb8a40) [0x7f6bda53fa40]
	/usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x1dd56) [0x7f6bda1f2d56]
	/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x133) [0x7f6bd8499d53]
	/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x480a0) [0x7f6bd849a0a0]
	/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_loop_run+0x6a) [0x7f6bd849a49a]
	/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0(gtk_main+0xa7) [0x7f6bda5bb2f7]
	[0x4180c542]

Debug info from gdb:

Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No threads.

=================================================================
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.
=================================================================

Note You need to log in before you can comment on or make changes to this bug.