473,698 Members | 2,132 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

NUnit Test Fails - System.Threadin g.ThreadStateEx ception

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 AutoCompleteSou rce Property (AutoCompleteSo urce.CustomSour ce) and
AutoCompleteMod e Property (AutoCompleteMo de.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
AutoCompleteSou rce & AutoCompleteMod e values, the Nunit test Fails
with the following error message.
------------------------------------------------------------------------------------------------------------------------------------------------
System.Threadin g.ThreadStateEx ception: Current thread must be set to
single thread apartment (STA) mode before OLE calls can be made. Ensure
that your Main function has STAThreadAttrib ute marked on it.
at
System.Windows. Forms.ComboBox. set_AutoComplet eSource(AutoCom pleteSource
value)
------------------------------------------------------------------------------------------------------------------------------------------------

Presently, what is possible is to catch the exception in a try...catch
block and if the ThreadStateExce ption 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 2013

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

Similar topics

5
4638
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 new connection is established. My Server code is : ---------------------------------------------------------------------
3
2056
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 DLL. I then wrote some unit tests for the Business DLL in another DLL (in another project). I'll refer to this DLL as Test.dll. So I run Test.dll through NUnit. For reasons I can't understand, the Business.dll is copied to a temp folder. ...
0
1737
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 when it tries to load the interop assembly. However, when I use the TestDriven.NET addin -- run via either Debugger or In-Proc -- the test runs fine. In trying to get a better idea of the problem, I found Suzanne Cook's blog. I tried...
0
1636
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 with entries for running single tests or debug them. It seems, then on C++ prgrams it can't find the TestAttribute, so it takes a long time until the context menu appears. Second, I get no context menu entries, nor in the cpp-file nor in the h-
6
8367
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 express at home (the labs may have an earlier version). does anyone know how to tell visual studio to use this dll? thanks
20
2016
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. Hence can someone who has used them before share his/her experience on them so that I can get a better idea and make a proper choice ? Any link or suggestions are also welcome. Thanks and Regards, Parag
1
5183
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 ActiveX control '648a5600-2c6e-101b-82b6-000000000014' because the current thread is not in a single-threaded apartment."
5
4471
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 one of the classes in this application needs to read a file from file system. The path is one directory below app path. e.g. if application is in C:\MyApp then the file would be in C:\MyApp\DataFiles directory. I used Reflection to get the path for...
2
2238
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. Everything is fine, compiles and the tests work fine on the basic application. However once I add some linq things to it, and specifically the line: WestoriaDataContext westoria = new WestoriaDataContext();
0
8672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9156
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9021
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8860
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7712
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2323
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.