You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WinForms VB.NET Designer requires WithEvents in .NET 11 whereas the same project works in .NET 10 #15366
Visual Studio Professional 2026 - Version: 18.11.3,
Visual Studio Professional 2026 Insiders - Version: 12328.396,
.NET version
.NET11
Did this work in a previous version of Visual Studio and/or previous .NET release?
No response
Issue description
We observed a difference in WinForms VB.NET Designer behavior between .NET 10 and .NET 11.
In .NET 10, a designer-generated control declared as:
Private Label1 As Label
works correctly, and the project builds, runs, and loads in the WinForms Designer without issues.
However, after migrating the same project to .NET 11, the WinForms Designer reports the following error:
1>D:\Winforms\WinFormsApp2\Form1.Designer.vb(49,13): error WFO3011: Designer component member 'Label1' must support the VB event model; add WithEvents to its declaration and use Handles for its named event handlers in the user partial (https://aka.ms/winforms-warnings/wfo3011)
The issue is resolved when the control declaration is changed to:
Friend WithEvents Label1 As Label
We would like to understand whether this is an intentional change in the .NET 11 WinForms Designer, a stricter designer validation rule, or a regression. We would also appreciate any documentation that explains why controls that previously worked without WithEvents in .NET 10 now require WithEvents in .NET 11.
Steps to reproduce
Create a WinForms VB.NET project targeting .NET 10.
Add a Label control to a form.
Modify the designer declaration from:
Friend WithEvents Label1 As Label
to:
Private Label1 As Label
Verify that the project builds and runs successfully in .NET 10.
Upgrade the project to target .NET 11.
Open the form in the WinForms Designer.
Observe that the Designer reports the following error:
"Designer component member 'Label1' must support the VB event model; add WithEvents to its declaration and use Handles for its named events."
Change the declaration back to:
Friend WithEvents Label1 As Label
Reopen the Designer and verify that the error is resolved.
@SaranRajChandrasekaran I believe there are stricter designer validation rules in the newer WinForms designer that are documented in "what's new". In my case the required changes were backward compatible to previous versions of .Net. "wfo3011" is just one of several.
Activity
paul1956 commentedon Nov 5, 2026
@SaranRajChandrasekaran I believe there are stricter designer validation rules in the newer WinForms designer that are documented in "what's new". In my case the required changes were backward compatible to previous versions of .Net. "wfo3011" is just one of several.