[Bug 796287] C# BasicTutorial6 doesn't work in Windows

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Mon May 21 23:57:38 UTC 2018


https://bugzilla.gnome.org/show_bug.cgi?id=796287

--- Comment #4 from tomislavtustonic at gmail.com ---
Hello

I looked a bit more into this, and the problem seems to be in glib-sharp.
The code throws in the method ToRegisteredType, in the line 315
(https://github.com/GtkSharp/GtkSharp/blob/develop/Source/Libs/GLibSharp/Value.cs#L315)
There, it's looking for a constructor with a GLib.Value parameter, but Bitmask
doesn't have such constructor, so it throws. It has a constructor which accepts
IntPtr.
As a proof of concept, I tried with reflection and managed to create a valid
object of type Bitmask.

Here's some code, in case you want to play with it:

var typeField = typeof(GLib.Value).GetField("type", BindingFlags.NonPublic|
BindingFlags.Instance);
var typeFieldValue = (IntPtr)typeField.GetValue(value);
var lookupType = GLib.GType.LookupType(typeFieldValue);

// ToRegisteredType  is looking for this constructor.
var ciInvalid = lookupType.GetConstructor(new[] { typeof(GLib.Value) });
// this one exists
var ciOk = lookupType.GetConstructor(new[] { typeof(IntPtr) });

var valuePtr = GLib.Marshaller.StructureToPtrAlloc(value);
Bitmask bitMask = (Bitmask)ciOk.Invoke(new object[] { valuePtr });


Tom

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list