473,428 Members | 1,666 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,428 software developers and data experts.

NUnit Test Fails - System.Threading.ThreadStateException

Hi,
I have a ["custom"] owner drawn combo box ["control"] (using .Net 2.0
Framework). I have written the Nunit test for the same. I am setting
the AutoCompleteSource Property (AutoCompleteSource.CustomSource) and
AutoCompleteMode Property (AutoCompleteMode.Append) for the Combo at
runtime and also have hidden these properties [Browsable(false)] at
design time.

Now, when I am testing the function where I am setting
AutoCompleteSource & AutoCompleteMode values, the Nunit test Fails
with the following error message.
------------------------------------------------------------------------------------------------------------------------------------------------
System.Threading.ThreadStateException: Current thread must be set to
single thread apartment (STA) mode before OLE calls can be made. Ensure
that your Main function has STAThreadAttribute marked on it.
at
System.Windows.Forms.ComboBox.set_AutoCompleteSour ce(AutoCompleteSource
value)
------------------------------------------------------------------------------------------------------------------------------------------------

Presently, what is possible is to catch the exception in a try...catch
block and if the ThreadStateException is thrown , I am logging it in a
file. I am still finding a solution to the problem. Presently, I have
just supressed the problem !

NOTE: This happens only when I run NUnit. But if I just run my
executable (when tests dont run) there are no issues.

Any Inputs ?
Thx In Advance
Angshuman Agarwal

Oct 16 '06 #1
0 1979

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Naveen Mukkelli | last post by:
Hi all, How can we use "NUnit" in socket programming. I mean, I'm writing a server program which accepts connection requests from the clients. I want to test the number of clients whenever a...
3
by: Frank Rizzo | last post by:
Here is the situation. I have a DLL that implements needed functionality. I'll refer to it as Business.dll. It depends on an XML (it contains config info) file being in the same directory as the...
0
by: Greg Bacon | last post by:
I have two C# projects: a production project and NUnit tests for it. I've recently added a test that causes a call into a registered COM component, and now the test fails with a TypeLoadException...
0
by: W. Schwenkner | last post by:
I use the NUnit VS addin intensivly in development C# projects. Now I have to write a project in managed C++ and I have problems with the NUnit addin. First, the Addin extends the context menu...
6
by: Ray Tayek | last post by:
hi, i am preparing to teach a class in c++ and would like to intoduce some unit testing. i can make unit tests in c# using this dll and nant from the command line. i am using visual c++ 2005...
20
by: Parag | last post by:
Hi, I am trying to figure out best testing tool for my project. I have narrowed down my requirements to two tools NUNIT and VSTS unit. But I have used neither and I have to use only one of them....
1
by: Pooh | last post by:
hi all, i faced an error in my project: "An unhandled exception of type 'System.Threading.ThreadStateException' occurred in system.windows.forms.dll Additional information: Could not instantiate...
5
nikpreek
by: nikpreek | last post by:
Hi All, This is my first post, I've been finding lots of solutions from this forum. Thanks to all who helped (and ones who asked questions). I have a strange problem. I'm having a console app and...
2
by: Mark Elliott | last post by:
Hi All, I'm just playing with asp.net mvc and link-to-sql for the first time. I'm using visual web developer 2008. I create the project fine, choose nunit as my test framework in the wizard. ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.