cancel
Showing results for 
Search instead for 
Did you mean: 

CheckSynchronize called from thread which is NOT the main thread

SOLVED
Occasional Contributor

CheckSynchronize called from thread which is NOT the main thread

In my Javascript project, I am trying to connect to a SQL database. When it gets to the Open() function, it throws an error that says "CheckSynchronize called from thread which is NOT the main thread" -- I can't click OK to get out of it, the message just keeps coming back. I have to end task in task manager and come back in. Below is my code. Right before the CheckSynchronize error comes up, it brings up a login dialog and enters the user name that is in the connection string. It doesn't appear to get to the password.

 

var aCon, RecSet;
aCon = ADO.CreateADOConnection();
aCon.ConnectionString = "Data Source=remoteDesktopAddress, portNumber;Initial Catalog=NameOfDatabase;user id=SQLuserName;password=SQLPassword";
aCon.Open();

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: CheckSynchronize called from thread which is NOT the main thread

Hi @hrothrock,

 

Thanks for checking this. It sounds like this question requires a deeper investigation. Could you please zip your project and send it to the TestComplete Support Team? They will analyze the project and come back to you with the solution.

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

View solution in original post

9 REPLIES 9
Community Hero

Re: CheckSynchronize called from thread which is NOT the main thread

That's rather strange.  ADO connections shouldn't actually do any displayed login or anything.  What kinda of SQL server are you connecting to?


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Occasional Contributor

Re: CheckSynchronize called from thread which is NOT the main thread

Microsoft SQL Server Developer (SQL 2016). 

Community Hero

Re: CheckSynchronize called from thread which is NOT the main thread

OK, what other code are you executing?  Again, because ADO doesn't open any sort of UI, I'm assuming that the login screen you're seeing is coming from some other code.  Let's set aside the ADO stuff for now because I think we're dealing with a different problem.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Occasional Contributor

Re: CheckSynchronize called from thread which is NOT the main thread

The code I showed is actually the first lines of code in the function that I am running, and it is the only function being run. My goal is to restore data to use for automation testing. Could it be something wrong with my connection string?

Community Hero

Re: CheckSynchronize called from thread which is NOT the main thread

Really?  There is no UI interaction code at all in that.  So, that tells me that something else is triggering some other code.  Do you have an OnStartTest event handler created that's kicking off some UI code/login process?  How are you kicking off that function (could you be accidentally running the project and not just the function)?

As mentioned... ADO has NO UI operations at all.  It's all object code behind the scenes.  So, we need to look elsewhere.  


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Occasional Contributor

Re: CheckSynchronize called from thread which is NOT the main thread

This is a fairly new project and I have not even brought the Events item into it yet. I am right-clicking in the function itself and just running the function.

Community Manager

Re: CheckSynchronize called from thread which is NOT the main thread

Hi @hrothrock,

 

Does TestComplete bring this error? Do you see the TC logo on the error dialog?

 

Is it possible that you run the function that has some parameters? For example, your code is inside a function like this:

function test(a, b)
var aCon, RecSet;
aCon = ADO.CreateADOConnection();
aCon.ConnectionString = "Data Source=remoteDesktopAddress, portNumber;Initial Catalog=NameOfDatabase;user id=SQLuserName;password=SQLPassword";
aCon.Open();
}

If you have the parameters in the function, you cannot run a routine via right-click.

 

Could you please check this?

 

 

 

 

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Occasional Contributor

Re: CheckSynchronize called from thread which is NOT the main thread

Tanya, I have no parameters in my function. I have tried this (accidentally) in the past and the option to run the function is disabled. I am not sure what program other than TestComplete would be returning the error but I guess it's possible?

 

Thanks.

Community Manager

Re: CheckSynchronize called from thread which is NOT the main thread

Hi @hrothrock,

 

Thanks for checking this. It sounds like this question requires a deeper investigation. Could you please zip your project and send it to the TestComplete Support Team? They will analyze the project and come back to you with the solution.

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

View solution in original post