@@ -22,6 +22,8 @@ static partial class TypeOffset
2222 internal static int mp_subscript { get ; private set ; }
2323 internal static int name { get ; private set ; }
2424 internal static int nb_add { get ; private set ; }
25+ internal static int nb_inplace_add { get ; private set ; }
26+ internal static int nb_inplace_subtract { get ; private set ; }
2527 internal static int ob_size { get ; private set ; }
2628 internal static int ob_type { get ; private set ; }
2729 internal static int qualname { get ; private set ; }
@@ -73,6 +75,7 @@ internal static void Use(ITypeOffsets offsets)
7375 }
7476
7577 ValidateUnusedTypeOffsetProperties ( offsetProperties ) ;
78+ ValidateRequiredOffsetsPresent ( offsetProperties ) ;
7679 }
7780
7881 static readonly BindingFlags FieldFlags = BindingFlags . NonPublic | BindingFlags . Static ;
@@ -102,5 +105,48 @@ static void ValidateUnusedTypeOffsetProperties(PropertyInfo[] offsetProperties)
102105 extras . Sort ( ) ;
103106 Debug . Assert ( extras . Count == 0 , message : string . Join ( ", " , extras ) ) ;
104107 }
108+
109+ [ Conditional ( "DEBUG" ) ]
110+ static void ValidateRequiredOffsetsPresent ( PropertyInfo [ ] offsetProperties )
111+ {
112+ var present = new HashSet < string > ( offsetProperties . Select ( p => p . Name ) ) ;
113+ var missing = new HashSet < string > ( ) ;
114+
115+ var thisAssembly = Assembly . GetExecutingAssembly ( ) ;
116+ var managedTypes = thisAssembly . GetTypes ( )
117+ . Where ( typeof ( ManagedType ) . IsAssignableFrom )
118+ . ToList ( ) ;
119+ foreach ( var managedType in managedTypes )
120+ {
121+ var slots = managedType . GetMethods ( BindingFlags . Public | BindingFlags . Static ) ;
122+ foreach ( var slot in slots )
123+ if ( ! present . Contains ( slot . Name ) )
124+ missing . Add ( slot . Name ) ;
125+ }
126+ foreach ( string notSlot in new [ ]
127+ {
128+ "__instancecheck__" ,
129+ "__subclasscheck__" ,
130+ "_AtExit" ,
131+ "AddReference" ,
132+ "FinalizeObject" ,
133+ "FindAssembly" ,
134+ "get_SuppressDocs" ,
135+ "get_SuppressOverloads" ,
136+ "GetClrType" ,
137+ "getPreload" ,
138+ "Initialize" ,
139+ "ListAssemblies" ,
140+ "Release" ,
141+ "Reset" ,
142+ "set_SuppressDocs" ,
143+ "set_SuppressOverloads" ,
144+ "setPreload" ,
145+ } )
146+ missing . Remove ( notSlot ) ;
147+
148+ Debug . Assert ( missing . Count == 0 ,
149+ "Missing slots: " + string . Join ( ", " , missing ) ) ;
150+ }
105151 }
106152}
0 commit comments