@@ -128,12 +128,18 @@ class StructureTests
128128 [ DllImport ( "LayoutClassNative" ) ]
129129 private static extern bool SimpleSeqLayoutClassByRef ( SeqClass p ) ;
130130
131+ [ DllImport ( "LayoutClassNative" ) ]
132+ private static extern bool SimpleSeqLayoutClassByRefNull ( [ In , Out ] SeqClass p ) ;
133+
131134 [ DllImport ( "LayoutClassNative" ) ]
132135 private static extern bool DerivedSeqLayoutClassByRef ( EmptyBase p , int expected ) ;
133136
134137 [ DllImport ( "LayoutClassNative" ) ]
135138 private static extern bool SimpleExpLayoutClassByRef ( ExpClass p ) ;
136139
140+ [ DllImport ( "LayoutClassNative" ) ]
141+ private static extern bool SimpleBlittableSeqLayoutClass_Null ( Blittable p ) ;
142+
137143 [ DllImport ( "LayoutClassNative" , EntryPoint = SimpleBlittableSeqLayoutClass_UpdateField ) ]
138144 private static extern bool SimpleBlittableSeqLayoutClassByRef ( Blittable p ) ;
139145
@@ -167,6 +173,13 @@ public static void SequentialClass()
167173 Assert . IsTrue ( SimpleSeqLayoutClassByRef ( p ) ) ;
168174 }
169175
176+ public static void SequentialClassNull ( )
177+ {
178+ Console . WriteLine ( $ "Running { nameof ( SequentialClassNull ) } ...") ;
179+
180+ Assert . IsTrue ( SimpleSeqLayoutClassByRefNull ( null ) ) ;
181+ }
182+
170183 public static void DerivedClassWithEmptyBase ( )
171184 {
172185 Console . WriteLine ( $ "Running { nameof ( DerivedClassWithEmptyBase ) } ...") ;
@@ -200,6 +213,13 @@ public static void BlittableClass()
200213 ValidateBlittableClassInOut ( SimpleBlittableSeqLayoutClassByRef ) ;
201214 }
202215
216+ public static void BlittableClassNull ( )
217+ {
218+ // [Compat] Marshalled with [In, Out] behaviour by default
219+ Console . WriteLine ( $ "Running { nameof ( BlittableClassNull ) } ...") ;
220+ Assert . IsTrue ( SimpleBlittableSeqLayoutClass_Null ( null ) ) ;
221+ }
222+
203223 public static void BlittableClassByInAttr ( )
204224 {
205225 // [Compat] Marshalled with [In, Out] behaviour even when only [In] is specified
@@ -269,9 +289,11 @@ public static int Main(string[] argv)
269289 try
270290 {
271291 SequentialClass ( ) ;
292+ SequentialClassNull ( ) ;
272293 DerivedClassWithEmptyBase ( ) ;
273294 ExplicitClass ( ) ;
274295 BlittableClass ( ) ;
296+ BlittableClassNull ( ) ;
275297 SealedBlittableClass ( ) ;
276298 BlittableClassByInAttr ( ) ;
277299 SealedBlittableClassByInAttr ( ) ;
0 commit comments