[Gtk-sharp-list] GIO# System.InvalidCastException in VolumeMonitor.MountAdded event

Chris Szikszoy chris at szikszoy.com
Sun Oct 11 07:56:22 EDT 2009

Hi Christian,

Thanks for the patch.  I gave it a try but am getting a different
exception now (with your test program).  I'm getting an
System.IndexOutOfRangeException.  From the test program, a.Args.Length
returns only 1, and I see that the generated code (from MD's assembly
browser now shows:
       get {

 unknown opcode: Isinst

I was, however, able to finally get the Mount from the event by doing this:
       Mount m = GLib.MountAdapter.GetObject (a.Args [0] as GLib.Object);
       Console.WriteLine (m.Name);

Thanks again, I'll be more than happy to test any other patches you
have as well.

Chris S.
(cszikszoy on Freenode & GimpNet)

On Sun, Oct 11, 2009 at 2:19 AM, Christian Hoff <christian_hoff at gmx.net> wrote:
> Chris Szikszoy wrote:
>> I saw that GIO# bindings landed in the mainline gtk# branch recently and
>> wanted experiment to see if I could replace the old Gnome.VFS in my
>> application.  I've built the latest gtk# from svn and am running into a
>> problem with the VolumeMonitor.Mount* signals.  I keep getting an
>> InvalidCastException when trying to access args.Mount from any of the
>> events
>> (MountAdded, MountRemoved, MountPreUnmount, MountChanged).
>> I've looked at the generated code and it seems to be failing at here:
>> public Mount Mount{
>>        get {
>>                return (GLib.Mount)GLib.SignalArgs.get_Args()[0];
>>        }
>> }
> I have attached a patch which fixes the issue together with a modified
> version of your test program. Mike, could you review?
> Christian

More information about the Gtk-sharp-list mailing list