I get an error on

Code:
Private Class ControlInfo
        Public ControlType As Type
        Public Properties As New Dictionary(Of String, Object)
        Sub New(ByVal ctrl As Control)
            ControlType = ctrl.GetType
            Dim value As Object
            For Each pi As Reflection.PropertyInfo In ControlType.GetProperties
                If pi.CanWrite Then
 ----------->>>>>                   value = pi.GetValue(ctrl, Nothing)
                    If value Is Nothing OrElse value.GetType.IsSerializable Then
                        Properties.Add(pi.Name, value)
                    End If
                End If
            Next
        End Sub
    End Class
Description is "Exception has been thrown by the target of an invocation."

when I try to apply

Code:
Dim fs As New IO.FileStream("c:\layout.bin", IO.FileMode.Create)
LayoutSerializer.SaveLayout(Me, fs)
fs.Close()
on my form closed event...