Thread.Start working in SQL 2005 but not SQL 2008
-
Thursday, May 03, 2012 8:11 PM
I have a CLR trigger which I was using on a SQL Server 2005 installation, and everything was functioning properly there. I am now trying to get it working on a SQL Server 2008 instance, but when I call System.Threading.Thread.Start(), it apparently does nothing. I can see that when I instantiate the class that contains the function to execute, the constructor is getting called (I put debug statements in the c'tor), but the debug statements at the start of the function to be executed (tp.DoIt) never get printed.
Current Env: SQL Server 2008 Std (not R2) SP3 x64 on Windows Server 2008 R2 Std x64, using .NET Fw 3.5.
My Thread code:
MyThreadPrinter tp = new MyThreadPrinter(timeStamp); Thread t = new Thread(new ThreadStart(tp.DoIt)); t.SetApartmentState(ApartmentState.STA); t.Start();
Thanks for any suggestions here.
-Conrad
All Replies
-
Monday, May 07, 2012 3:19 AMModerator
Hi Conrad,
Is there any exception during the debugging?
TechNet Subscriber Support
If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.Stephanie Lv
TechNet Community Support
-
Monday, May 07, 2012 3:46 AM
No, no exception.
I was able to narrow down the problem to the fact that I am doing some WPF printing in my trigger. When the assemblies System.Printing, System.Drawing and PresentationFramework are loaded, then Thread.Start() silently fails. When these are not loaded by SQL Server, then Thread.Start() works as expected. Since these are officially "unsupported" assemblies, I guess I will have to find some other way to do what I want here.
-Conrad
- Marked As Answer by cgtyoder Tuesday, May 08, 2012 7:17 PM

