Click “View Details”, investigate and show the details and try determining the problematic line of InitializeComponent.
Null reference when callling InitializeComponent
I have just converted a VB Windows Forms project from .NET 4.7 to .NET 5. When I try to run it I get a Null Reference exception on the call to InitializeComponent at the head of the call of New() to the main form - see the screen shot. This is odd because there's nothing to reference apart from Me, which has surely been instantiated by the time this call is made - certainly hovering the cursor over local field names gives a value.
It's possible that I've left something out of the project file when editing it, but I can't see what.
Developer technologies VB
1 additional answer
Sort by: Most helpful
-
Karen Payne MVP 35,586 Reputation points Volunteer Moderator
2021-05-16T17:23:17.9+00:00 For a .NET 5 form, InitializeComponent is in the form designer file not in user code (when double clicking on the form)