How does the version of the framework play into this? 2013 needs mscorlib, Version=4.0.0.0, while 2012 can do with mscorlib, Version=2.0.0.0.
That's clearly a bug. You can't cast anything boxed in a System.Object to an IntPtr, and trying to do that doesn't give you the address of a reference type if that's what's in the object.
Even if casting to an IntPtr were possible, I don't see how it can possibly work, as the GC can move the object around in memory. If the object isn't moved it might work, otherwise it will fail.
Typically, a pinned GCHandle is needed to hold a reference to managed data in native code.
Another possible problem is that when you have a reference to a managed object stored in an IntPtr, the reference to the managed object must be kept alive and reachable in order to ensure it doesn't get garbage collected.