@@ -293,6 +293,42 @@ public void Updates_nested_complex_property_nullability_for_pre_10_snapshots()
293293 Assert . Empty ( reporter . Messages ) ;
294294 }
295295
296+ [ ConditionalFact ]
297+ public void Updates_property_bag_complex_property_nullability_for_pre_10_snapshots ( )
298+ {
299+ var builder = new ModelBuilder ( ) ;
300+ var model = builder . Model ;
301+ ( ( Model ) model ) . SetProductVersion ( "9.0.0" ) ;
302+
303+ builder . Entity (
304+ "TestEntity" , b =>
305+ {
306+ b . Property < int > ( "Id" ) ;
307+ b . HasKey ( "Id" ) ;
308+
309+ b . ComplexProperty ( typeof ( Dictionary < string , object > ) , "Value" , "TestEntity.Value#StructValue" , b1 =>
310+ {
311+ b1 . Property < int > ( "Value" ) ;
312+ } ) ;
313+ } ) ;
314+
315+ var entityType = model . GetEntityTypes ( ) . Single ( ) ;
316+ var complexProperty = entityType . GetComplexProperties ( ) . Single ( ) ;
317+ Assert . Equal ( typeof ( Dictionary < string , object > ) , complexProperty . ClrType ) ;
318+
319+ var complexPropertyInternal = ( ComplexProperty ) complexProperty ;
320+ Assert . Null ( complexPropertyInternal . GetIsNullableConfigurationSource ( ) ) ;
321+ Assert . True ( complexProperty . IsNullable ) ;
322+
323+ var reporter = new TestOperationReporter ( ) ;
324+ var processor = new SnapshotModelProcessor ( reporter , DummyModelRuntimeInitializer . Instance ) ;
325+ processor . Process ( model ) ;
326+
327+ Assert . NotNull ( complexPropertyInternal . GetIsNullableConfigurationSource ( ) ) ;
328+ Assert . False ( complexProperty . IsNullable ) ;
329+ Assert . Empty ( reporter . Messages ) ;
330+ }
331+
296332 private static void AssertSameSnapshot ( Type snapshotType , DbContext context )
297333 {
298334 var differ = context . GetService < IMigrationsModelDiffer > ( ) ;
0 commit comments