Add ServiceStack Reference created DTOs do not handle properties using reserved keywords properly in VB.NET

We are trying to utilize the ServiceStackVS plugin, but it seems we are having some issues with reserved words between .NET languages. All of our services were coded in C#, but some of our consumers are now in VB.NET.

This is the offending class in VB.NET (Operator being a reserved word in VB.NET it needs to be escaped with square brackets):

Public Partial Class ContractAccessorialOptionCriteria
        Public Overridable Property AccessorialOptionCriteriaGuid As Guid
        Public Overridable Property AccessorialOptionGuid As Nullable(Of Guid)
        Public Overridable Property Name As String
        Public Overridable Property Value As String
        Public Overridable Property DateType As String
        Public Overridable Property Operator As String
        Public Overridable Property CreatedBy As String
        Public Overridable Property CreatedDate As Nullable(Of Date)
        Public Overridable Property UpdatedBy As String
        Public Overridable Property UpdatedDate As Nullable(Of Date)
        Public Overridable Property ExpiredBy As String
        Public Overridable Property ExpiredDate As Nullable(Of Date)
    End Class

So the Operator property should get generated as

Public Overridable Property [Operator] As String

Thanks,
Richard Safier
Panther Premium Logistics

Hi @rsafier,

Thanks for posting the issue. I’ve created a PR to resolve the problem of the ‘Operator’ reserved keyword. If you have a reproducible problem like this, feel free to raise it an as issue in the ServiceStack Issues github repository.

I’ll update you here when the change is available from MyGet.

FYI the latest version with this change is now available on MyGet.

2 Likes

I am having the same problem. The Two Property names that need brackets [] around them are Date, End and end (lower case).

These keywords have been added in this commit which is now available on MyGet.

Great. Thank for the quick response.

1 Like