Util.BitmapToBMPFile doesn't work

Running the following code doesn’t seem to work.

Bitmap bmp = new Bitmap(10, 10);
byte[] outputFile = new byte[bmp.Width * bmp.Height * 4 + 54];  //changed to 4 from 3 to fit rawBits
byte[] rawBits = bmp.GetBitmap();       //This results in a array of length 400 not 300 as expected.
Util.BitmapToBMPFile(rawBits, bmp.Width, bmp.Height, outputFile);

Firstly the GetBitmap() method returns a array of 4 * width * height rather than 3 as seems to be required by BitmapToBMPFile. I have tried with both 3 and 4.

Whatever I do I get this error:-

Exception System.NotSupportedException - CLR_E_NOT_SUPPORTED (1)

Am I doing something wrong? I have included GHI.Premium.System in the references and am using

On which hardware please?

Emulator initially. But I will be targeting the G120 later.

@ andre.m

Thanks, that seems to work correctly. I didn’t realise that the premium libraries wouldn’t work in the emulator.