WPFInterop.BitmapBuffer.BitmapBuffer()

Jun 15, 2010 at 1:00 PM

There is an error with that static BitmapBuffer() function when trying to view the "2D Example" tab in Design view, because of wrong assumption that the very first method returned by GetMethods() is always the Lock() method.

During run time the returned array is "Lock", "SetResolution", "SetPalette" as authors have expected.

During design time the returned array is "SetResolution", "Lock", "SetPalette" as authors have NOT expected.

The correct code piece follows.

MethodInfo[] info = wicBitmapNativeMethodsClass.GetMethods(BindingFlags.Static | BindingFlags.NonPublic);
/* This method looks good */
//_lockmethod = info[0]; // No, it DOESN'T look good this way during design time!!!
for (int i = 0; i < info.Length; i++)
{
    MethodInfo myMethodInfo = (MethodInfo)info[i];
    if (myMethodInfo.Name == "Lock") { _lockmethod = myMethodInfo; }
}

Jun 15, 2010 at 1:12 PM

Sorry I have posted my bug report to a wrong project Discussions list.

The correct project is based on this one particular project.

The correct project Discussion thread is available at the following link.

WPFInterop.BitmapBuffer.BitmapBuffer()