[Mono-dev] Implementation of SetPropertyItem

Patrick Kowalzick patrick.kowalzick at web.de
Tue Nov 23 13:41:48 EST 2010


Dear List,

I found that System.Drawing.Image::SetPropertyItem throws a 
NotImplementedException.

The code from
<https://github.com/mono/mono/blob/master/mcs/class/System.Drawing/System.Drawing/Image.cs>
looks like

public void SetPropertyItem(PropertyItem propitem)
{
   throw new NotImplementedException ();
   /*
     GdipPropertyItem pi = new GdipPropertyItem ();
     GdipPropertyItem.MarshalTo (pi, propitem);
     unsafe {
       Status status = GDIPlus.GdipSetPropertyItem (nativeObject, &pi);
       GDIPlus.CheckStatus (status);
     }
   */
}

On a first glance the code inside the comment doesn't look that bad, and 
I do not understand why it is commented out.

The Implementation of GdipSetPropertyItem in libgdiplus could work as well:
[https://github.com/mono/libgdiplus/blob/master/src/image.c]


I have two questions concerning this issue:

1.) How do I find out, why the code is disabled?

2.) If the libgdiplus code is incorrect, couldn't the SetPropertyItem 
check for Windows, then using the commented code? Something like:

public void SetPropertyItem(PropertyItem propitem)
{
   if (!IsWindows())
     throw new NotImplementedException ();
   else
   {
     GdipPropertyItem pi = new GdipPropertyItem ();
     GdipPropertyItem.MarshalTo (pi, propitem);
     unsafe {
       Status status = GDIPlus.GdipSetPropertyItem (nativeObject, &pi);
       GDIPlus.CheckStatus (status);
     }
   }
}


Thanks and kind regards,
Patrick



More information about the Mono-devel-list mailing list