VB question

I have encountered some strangeness in NETMF with VB. The following function definition throws an error “Constant expression is required” indicating the Microsoft.VisualBasic.Constants.vbcrlf is not a constant.
This same Microsoft.VisualBasic.Constants.vbcrlf can be used in other parts of the code as intended.
The same function definition in regular VB.NET works fine.

       
Function Something(Optional x As String = Microsoft.VisualBasic.Constants.vbCrLf) As String
            Return x
End Function

The object Browser shows that Microsoft.visualbasic.constants.vbcrlf does exist as part of Microsoft.VisualBasic.

Assuming this is a problem in the NETMF 4.3, and not something I have overlooked, where should I post this as a bug?

Thanks

@ Andre.m: Thanks for the answer. It is not that I need a workaround which I already have, but that this should be fixed. My question is if this is a NETMF implementation bug, what is the best way to bring it to the attention of those who might fix it?

In full NET:

public sealed class Constants
{
public const string vbCrLf = "\r\n";
// ...
}

In NETMF:

public sealed class Constants
{
public static string vbCrLf = "\r\n";
// ...
}

If you ask me, I think it is a bug and it is related to NETMF exclusively.

@ andre.m, @ iamin: Thanks for your comments. I submitted this to github:

1 Like

I do not think that it is a bug in the framework but rather an IDE integration issue. The same as https://www.ghielectronics.com/community/forum/topic?id=14663 for BitShift operators in VB.

I would also submit a bug report.

It does look as a bug to me. As @ iamin pointed out in NETMF vbCrLf declared as a static not as a const value.
An optional parameter expects its default value be a const.

The issue was accepted as a bug and fixed by Steve Maillet today. Should be in 4.4. :clap:

If only they could fix bit shift operators that easily… I hate using these workaround so much :wall:

1 Like