Error "Visual Basic 9.0 does not support auto-implemented properties" on an interface in Visual Studio 2015 RC

In my case, using VS2015 Community, the real problem was a blank line between the property header and the Get method. See my screenshots below:

Before: (Error image)

enter image description here

After: (No error image)

enter image description here


This does indeed appear to be a bug in the Roslyn compiler. The compiler is running in an odd mode where its checking (but not really compiling) the code within App_Code - that code actually gets compiled when the site starts up.

Since it knows that you've set the code to run under v3.5, it assumes that the code will actually be compiled by the "v2.0" compiler, so it's effectively running the check/compile as if you've specified the /langversion flag as 9.

So, that's why the error message is talking about things not supported by Visual Basic 9. However, if you compile the code with real VB9 compiler, it of course compiles fine.

As evidence that the compiler is rather confused, I changed your sample to:

Public Interface ICurrentStep
    Property outerstep() As String = "Hello"
    Property innerstep() As String
End Interface

This should produce an error about not being allowed an initializer in an interface. However, instead of just two error messages stating "Visual Basic 9.0 does not support auto-implemented properties." we also get the error "Expanded Properties cannot be initialized.". But, this does not make sense:

there are situations in which you cannot use an auto-implemented property and must instead use standard, or expanded, property syntax.

That is, a single property can either be auto-implemented or expanded.


My recommendation would be to move as much code as possible out of App_Code - either just outside of it or into a different library. This will then mean that the code is actually compiled by the Roslyn compiler directly (and without the /langversion setting) and that you can actually start making using of modern VB features (you can still target v3.5 but use later language features)

In the alternative, you can leave the code in App_Code and choose to ignore the errors. If it's just two errors, that may be feasible in the short term.


I have a project that is in the process of moving to use VS2015 from VS2008. We need to support both environments in the short term so I have created VS015 .vbproj files that include the directive 9 in the PropertyGroup section of the file.

I was getting this error because there was a comment between the Property declaration and the Get clause. For example

Private ReadOnly Property MemberNode() As XmlNode</br>
    ' This is the only place which locates the objMember node
    Get
        Return CreatePathAndNode(mnodMessage, "objData/colMember/objMember")
    End Get 
End Property

Moving the comment before the "Private Readonly" line removed the compiler error in VS2015.