Marshal class in Interop is catching memory errors better

Since Beta2 came out, I have been trying to do my new development there to test the C# IDE, but not using any 2.0 features so I can still compile on another PC using VS .NET 2003 for production.
I was recently testing some interop code that uses P/Invoke calls. I was allocating a block of memory to represent an array of handles. I erroneously specified the size of this block as "IntPtr.Size" instead of "nRows * IntPtr.Size". Running the program under .NET 2.0 caused it to fail on a call to Marshal.FreeHGlobal with the pointer every time, as opposed to compiling and running it under .NET 1.1, where it only failed sporadically.
Good job to the Interop team for improving reliability!
Chuck
[710 byte] By [ChuckHeatherly] at [2008-1-19]

.NET Development

Site Classified