vb.netvisual-studiowinformssystem.diagnostics

How do I fix Error BC32035 - Attribute specifier is not a complete statement?


'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.  
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>

Private Sub InitializeComponent()
    Me.components = New System.ComponentModel.Container
    Me.cmd_View_Old_Notes = New System.Windows.Forms.Button
    Me.cmd_Save_Note = New System.Windows.Forms.Button
    Me.rpt_Viewer = New CrystalDecisions.Windows.Forms.CrystalReportViewer

The error in the Visual Studio 2019 IDE is

Severity    Code    Description Project File    Line    Suppression State
Error   BC32035 Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement. ProjectName PathToProject\frm_Main.vb   20  Active

I am updating an old project from Visual Studio 2005 to VS2019. It uses VB.Net

I can't add a _ after DebuggerStepThrough()> because VS2019 removes it automatically


Solution

  • ▶ Remove the space/line feed between the Attribute and the method this Attribute is applied to.

    From the documentation:

    Error BC32035 - Attribute specifier is not a complete statement

    (...) An attribute block appears alone on a source-code line. Attributes must be applied at the beginning of a declaration statement, and they must be part of that statement. (...)

    To correct this error:

    (...) If no declaration statement is associated with the attribute block, either supply one or remove the attribute block. (...)