Exception from CompositionEngine.RenderToWriteableBitmap

Sep 26, 2013 at 3:55 PM
Hi,

I'm running the WriteableBitmapRenderTestPage sample as I'm looking to utilize saving a xaml canvas containing some custom paths to an image. However, when running the sample (and my own app) I am getting the exception:

System.NotSupportedException: Unable to expand length of this stream beyond its capacity.
at System.IO.UnmanagedMemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)


The exception is coming near the end of the for loop within CompositionEngine.RenderToWriteableBitmap when writeStream.Write(buffer, 0, buffer.length) is applied.

If I adjust the size of the buffer to be mappedRect.Pitch - 12, the xaml is rendered but when using the OverloadPreview button the rendered image does not quite align towards the bottom of the image.

Any ideas on what to look at here?

Thanks
Coordinator
Sep 26, 2013 at 4:30 PM
Not really, sorry. I'd have to dig into the code and experiment myself.
Sep 26, 2013 at 5:47 PM
Ok, thanks.

Any confirmation that the sample runs without error that would help as well.

Also, I should mention that this was through Visual Studio 2012 / Windows 8 64bit

Thanks
Coordinator
Sep 26, 2013 at 6:11 PM
Can you share a screenshot of what you mean exactly? Sorry, I don't have an 8.0 machine anymore, but it used to work just fine. If something broke in recent versions - I'd check an older version of the source to see if that'd work.