A ref class declares a class which is managed by the garbage collector. One strong restriction that the C++/CLI compiler applies to such declarations is that such class cannot contain non-managed objects. That very often turns out poorly when the object is moved when the heap is compacted, invalidating unmanaged pointers to such non-managed objects.
The likely trouble-maker is the Point
type, there are no other candidates. A sample declaration for a managed Point type that doesn't have this problem is:
public value struct Point {
int x, y;
};
Or use the baked-in System::Drawing::Point type instead.