Public ReadOnly Property Prop() As Object
Get
Try
Prop = New Object
Exit Property
Catch ex As Exception
End Try
End Get
End Property
Public Function Func() As Object
Try
Func = New Object
Exit Function
Catch ex As Exception
End Try
End Function
Erroneous output
public object Prop
{
get
{
object PropRet = default;
try
{
PropRet = new object();
return default; //this should've been `PropRet`
}
catch (Exception ex)
{
}
return PropRet;
}
}
public object Func()
{
object FuncRet = default;
try
{
FuncRet = new object();
return FuncRet;
}
catch (Exception ex)
{
}
return FuncRet;
}
(the
Function
code below is for comparison)VB.Net input code
Erroneous output
Expected output
Details