[System.Reflection.DefaultMember(nameof(Caption))]
public class ClassWithReflectionDefaultMember
{
public string Caption { get; set; }
}
Then in VB.NET, access its DefaultMember:
<System.Reflection.DefaultMember(NameOf(LoosingProperties.Caption))>
Public Class LoosingProperties
Public Property Caption As String
Sub S()
Dim x = New LoosingProperties()
x.Caption = "Hello"
Dim y = New ClassWithReflectionDefaultMember() 'from C#
y.Caption = "World"
End Sub
End Class
Erroneous output
[System.Reflection.DefaultMember(nameof(Caption))]
public class LoosingProperties
{
public string Caption { get; set; }
public void S()
{
var x = new LoosingProperties();
x.Caption = "Hello"; // works differently for equivalent VB.NET class
var y = new ClassWithReflectionDefaultMember(); // from C#
y = "World"; // <----- notice `.Caption` is missing here
}
}
Expected output
[System.Reflection.DefaultMember(nameof(Caption))]
public class LoosingProperties
{
public string Caption { get; set; }
public void S()
{
var x = new LoosingProperties();
x.Caption = "Hello";
var y = new ClassWithReflectionDefaultMember(); // from C#
y.Caption = "World";
}
}
Details
Product in use: VS extension
Version in use: bc365b0f51a4194652f5d203022997432b819797
Did you see it working in a previous version, which? no
Any other relevant information to the issue, or your interest in contributing a fix.
VB.Net input code
We need a C# project with a class like this:
Then in VB.NET, access its DefaultMember:
Erroneous output
Expected output
Details