AccessViolationException with Awesomium generating a bitmap for XNA
<p>I am trying to render the Awesomium headless browser in a BackgroundWorker. </p>

<p>However, when i try to copy the buffer using CopyTo, 
i get an AccessViolationException saying that i am trying to access protected memory. 
This is my first time using the System.Drawing namespace.</p>

<p>Here is my code:</p>

<pre><code>            RenderBuffer b = browser.Render();
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(size.Width, size.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            System.Drawing.Imaging.BitmapData bmd = bmp.LockBits(new System.Drawing.Rectangle(0, 0,size.Width, size.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, bmp.PixelFormat);
            b.CopyTo(bmd.Scan0, bmd.Stride, 4, false, false);
            bmp.UnlockBits(bmd);
            System.IO.MemoryStream dat = new System.IO.MemoryStream(bmp.Width * bmp.Height * 4);
            bmp.Save(dat, System.Drawing.Imaging.ImageFormat.Png);
            page = Texture2D.FromStream(Game.GraphicsDevice, dat);
            bmp.Dispose();
</code></pre>

<p>Thanks in advance!</p>