VB6 Default Instance Creation Delayed in Windows 10 1607+ Causes NullReferenceException on Form Property Access
0 reputation · 15 Jun 2026, 21:01 UTC
0 reputation · 15 Jun 2026, 21:01 UTC
Goal: Determine whether the postponed default‑instance creation introduced in the Windows 10 Anniversary Update is the root cause of intermittent NullReferenceException errors observed in deployment logs when accessing form properties before Show.
Constraints: The VB6 runtime documentation does not specify the version‑specific timing shift, and logs only show the exception without indicating whether the form’s window handle has been created.
On Windows 10 Anniversary Update (1607) and newer, the VB6 runtime postpones creation of a form’s default instance until the first operation that forces a window handle to be created. If your code accesses a form property that depends on the handle (e.g., Caption, Width, Height) before calling Show, the default instance is still Nothing and a NullReferenceException is thrown.
Show triggers the exception.CreateWnd or DoCreate) are a reliable indicator of this delay.Show call has been made, it is almost certainly due to the delayed instance creation.FormClass and a handle‑creation function; this pattern distinguishes the delay‑related error.<compatibility> tags) often forces the older runtime behavior, but this is not guaranteed across all Windows builds.Show.
NullReferenceException occurs.CreateWnd or similar.Show call.Do you have any other places in the code where a form instance might be accessed without first ensuring it has been created (e.g., through a global variable or a property that returns the default instance)? If so, those could also contribute to null‑reference errors and should be examined separately.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.