Share via


SQL Server Troubleshooting: Invoke or BeginInvoke cannot be called in control unit until the windows handle has been created

**                                                                           Error message:**

** **

** SQL server setup has encountered the following error: Invoke or BeginInvoke cannot be called in a control unit until the windows handle has been created.**

I came across the same issue, tried the conventional resolutions available on the net like keeping the installer window in focus, close all other windows explorer, IE instances, create a c:\temp folder, got the hotfix from Microsoft:

http://blogs.msdn.com/b/petersad/archive/2009/08/14/invoke-or-begininvoke-cannot-be-called-on-a-control-until-the-window-handle-has-been-created.aspx

We were/are waiting for a new release to rule the bug out.

Here I present to you an alternative solution that has worked for me in multiple occasions when I encountered the error.

Some background information: you will get this error but not very often, if the box is new. Chances of the error showing up on a box which has any instance of MS SQL Server installed is very high.

A word of caution: The resolution requires working/deleting entries from the registry , and if done in a wrong manner, can cause irreversible changes to your OS Kernel. Take extreme caution every time you work with the registry and make sure to take a full registry backup before starting the registry editing.

OK, so moving on, let's see how we can overcome this roadblock.

After receiving the error , I checked the event logs on application and system , but couldn't find anything relevant so I tried to find the root cause of the issue.

Checking in the registry under :

and under: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server , I found a stale entry for an old installation that was uninstalled long back. Delete the key.

Delete the Old MS SQL Server folder from Program Files.

next 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\SNI10.0\LastConnect I found that the installer had tried to connect to port 1433 .

Delete the MSSQLServer  key.

Run a portqwry to check and see if the port is blocked , if so unblock the port from the local firewall for both TCP & UDP inbound and outbound .

Next phase of action is to check the compatibility under which the installer is running.

This can be done by rt clicking on the installer > properties > compatibility.

By default it would be greyed out: check it and select Windows 7 if you are running server 2008 r2 /r2 SP1 , as the kernel but for r2 and Win 7 share the same code with come added server side features on 2008 r2.

The next phase of action is to go to the bottom of that dialog box and click on Compatibility for all Users. Choose windows 7 and make sure to check the option “Run this program as Administrator”.

Now it's time to check the UAC settings : set them to lowest :

Reboot the changes so that the changes in the registry can be loaded up in runtime.

After the box reboots, make sure that the compatibility settings are in place and launch the installer .

You would go through the extraction phase :

and after a few minutes you will see the installer load up :

and after a pause of about a few  seconds approx. you would get the installer screen:

Now carry on with the installation. Things should work as expected.

Hope this article was useful.