Last active
December 10, 2015 00:18
-
-
Save jacksonh/4349576 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // invoke this in your appdelegate | |
| #if DEBUG | |
| private void ScanForUnresurrectableMonoTouchTypes () | |
| { | |
| var found_bad = false; | |
| var intptr_ctor = new Type [] { typeof (IntPtr) }; | |
| var types = GetType ().Assembly.GetTypes (); | |
| foreach (var t in types) { | |
| if (!t.IsSubclassOf (typeof (NSObject))) | |
| continue; | |
| if (t.GetConstructor (intptr_ctor) != null) | |
| continue; | |
| var mttype = t.BaseType; | |
| while (mttype.Assembly != typeof (NSObject).Assembly) | |
| mttype = mttype.BaseType; | |
| Console.WriteLine ("Found a type with no intptr ctor: '{0}' inherits from: '{1}'", t, mttype); | |
| found_bad = true; | |
| } | |
| if (found_bad) | |
| throw new Exception ("You have NSObject types without IntPtr ctors."); | |
| } | |
| #endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment