Monotouch generic link type error

I installed the latest version of Monotouch, and I began to see the following error when trying to deploy my assembly to the device.

Error MT4112: the registrar has detected an invalid type. The argument of the generic type "T" must have a constraint of the reference type in order to be exported to ObjectiveC. (MT4112)

It looks like I need to add a where clause in the class here, but it does not work in Monotouch.

public class NotificationObject<T> : NSObject { public T Data { get; set; } } 
+8
objective-c
source share
1 answer

This is a known issue in MonoTouch 6.0.2.

Note that creating general subclasses of NSObject or exporting common classes to ObjectiveC is not supported. It may work, or it may collapse unpredictably and randomly.

In the future, we plan to support at least some scenarios of exported generic classes, but this does not apply to the nearest roadmap, so there is no time.

+10
source share

All Articles