Here are some tips I've learned the hard way after wrapping some nasty things into managed code (including wrappers for the native debugging API and reading minidumps):