Open
Description
.NET version
.NET 6+
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
.NET 3.1
Issue description
The new overloads we introduced for Control.Invoke
breaks Visual Basic code.
This used to be OK before:
If String.IsNullOrEmpty(Me.Text) Then
>> Me.Invoke(Sub()
>> myDataGridForm.BindableDataGridView.DataSource = myDataSource
>> End Sub)
Return
End If
This does no longer work.
The reason is that the Visual Basic compiler automatically creates the expected type for a Lambda. So here, the identifier names represents the actual types, which the compiler automatically generates.
To correct this, we need to rewrite it and help the compiler to create the correct type like this (as one solution):
If String.IsNullOrEmpty(Me.Text) Then
Me.Invoke(New Action(
Sub()
myDataGrid.DataSource = myDataSource
End Sub))
Return
End If
Steps to reproduce
Just try the above discussed code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment