Vehicle.GetModelClass(veh)
Gives the error: Type VehicleClass cannot be marshaled as an unmanaged structure.
Internally this function uses
Function.Call<VehicleClass>(Hash.GET_VEHICLE_CLASS_FROM_NAME, veh.Hash)
and calling this on its own also caused the error.
My fix for it was changing the return value to uint and casting the results like so:
(VehicleClass)Function.Call<uint>(Hash.GET_VEHICLE_CLASS_FROM_NAME, veh.Hash);