Attempted to read or write protected memory. This is often an indication that other memory is corrupt. C# Error
See the question and my original answer on StackOverflowIf you're using WPF, you should not use unsafe code, but instead play nice with WPF. This is what the WriteableBitmap Class is for I think.