Master/Detail Hierarchy datagrid error when expanding empty master record

This is the same issue. Fix is use foreach instead of ForEach()