File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,19 @@ public static void ClearStash()
137
137
PySys_SetObject ( "clr_data" , IntPtr . Zero ) ;
138
138
}
139
139
140
+ static bool CheckSerializable ( object o )
141
+ {
142
+ Type type = o . GetType ( ) ;
143
+ do
144
+ {
145
+ if ( ! type . IsSerializable )
146
+ {
147
+ return false ;
148
+ }
149
+ } while ( ( type = type . BaseType ) != null ) ;
150
+ return true ;
151
+ }
152
+
140
153
private static void SaveRuntimeDataObjects ( RuntimeDataStorage storage )
141
154
{
142
155
var objs = ManagedType . GetManagedObjects ( ) ;
@@ -151,7 +164,7 @@ private static void SaveRuntimeDataObjects(RuntimeDataStorage storage)
151
164
switch ( entry . Value )
152
165
{
153
166
case ManagedType . TrackTypes . Extension :
154
- Debug . Assert ( obj . GetType ( ) . IsSerializable ) ;
167
+ Debug . Assert ( CheckSerializable ( obj ) ) ;
155
168
var context = new InterDomainContext ( ) ;
156
169
contexts [ obj . pyHandle ] = context ;
157
170
obj . Save ( context ) ;
@@ -195,7 +208,7 @@ private static void SaveRuntimeDataObjects(RuntimeDataStorage storage)
195
208
{
196
209
if ( ! item . Stored )
197
210
{
198
- if ( ! item . Instance . GetType ( ) . IsSerializable )
211
+ if ( ! CheckSerializable ( item . Instance ) )
199
212
{
200
213
continue ;
3AEE
201
214
}
You can’t perform that action at this time.
0 commit comments