I have a C++ unmanaged class NativeDog that needs to be used from C#, so I\'ve create a wrapper class ManagedDog.
NativeDog
ManagedDog
// unmanaged C++
In your managed code, add GC.KeepAlive(dog) following the call to FeedDogManaged():
GC.KeepAlive(dog)
http://msdn.microsoft.com/en-us/library/system.gc.keepalive(VS.71).aspx
You need a GC::KeepAlive() call in your FeedDogManaged function. Seems like it is an exact use case for that.
FeedDogManaged