Visual Studio 2010 kills (there is no other word) data in one of the arguments of the function in the unsafe block. What could cause this error? The following message shows
I have faced the same issue and the solution for me is change Solution Configuration from Release to Debug. Hope it helps
Solution Configuration
Release
Debug