|
|
|
|
When using a COM component created by a company known for their great cross platform statistics software, but not known for their Windows expertise, creates a COM component and sets the component’s threading model to both (STA and MTA models), don’t trust it. If said component was developed for and tested against VB 6.0 and you are using .Net, don’t trust that it can handle MTA, even though their sample .Net code never checks to make sure it is running on STA thread. And if you are really foolish enough to try to use this component in a multithreaded service, and it works “almost” all the time, but occasionally hangs all threads in the process, the first thing you should do is make sure all threads that call the component have their ApartmentState set to STA. Then make sure that the wrapper dll that you wrote to make life easier to deal with this crazy component checks the thread’s ApartmentState, and throws an error if it isn’t STA.
Life would be so much easier if I trusted my instincts instead of the documentation.
DonXML Demsak
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using
|
|
|
|
|
About donxml
I’m an independent consultant, specializing in .Net solutions architecture, based out of New Jersey who also doubles as an evangelist for XML, Domain Driven Design, enterprise architecture and .Net. I do not work for Microsoft, the W3C or any other big company that you may know of (at least not yet). I’ve been an indie for over ten years, and although I’ve been tempted a couple times to take a job with companies like Microsoft, I’ve haven’t found something better than my current situation. I work mostly with the large pharmaceuticals that are based here in New Jersey, and usually find myself on long term contracts. Definitely not the prototypical indie consultant, but it lets me dedicate time to my non-income generating activities like the developer community stuff, plus financing open source projects like XPathmania and MVP-XML. If you would like to talk to me about doing some contract work, just contact me via the contact page. My rates vary widely, depending on lots of different variables, but mostly distance from Jersey, and type of work. Plus, I’ve been known to donate some of my code for various projects.