S
Stefan
Hi,
although main() has [STAThread] attribute, somehow my C#/VS2005 win
form application changed to MTA mode. Within the application I create
a backgroud process that does the work to be able to update a progress
bar in the main window. After the backgroud process is completed
(backgroundWorker_RunWorkerCompleted was called), I want to write some
info to LOG-files. Upon calling saveFileDialog.ShowDialog(this) to get
a filename, I get the STAThreadAttribute exception. Just before this
call I checked System.Threading.Thread.CurrentThread.ApartmentState
which is then MTA.
So my questions are:
- what makes my application switch to MTA
- what can I do to bring it back to STA
- why this OLE call
Thanks in advance for any hints!
Stefan
P.S.: This is a repost from
microsoft.public.dotnet.framework.windowsforms
although main() has [STAThread] attribute, somehow my C#/VS2005 win
form application changed to MTA mode. Within the application I create
a backgroud process that does the work to be able to update a progress
bar in the main window. After the backgroud process is completed
(backgroundWorker_RunWorkerCompleted was called), I want to write some
info to LOG-files. Upon calling saveFileDialog.ShowDialog(this) to get
a filename, I get the STAThreadAttribute exception. Just before this
call I checked System.Threading.Thread.CurrentThread.ApartmentState
which is then MTA.
So my questions are:
- what makes my application switch to MTA
- what can I do to bring it back to STA
- why this OLE call
Thanks in advance for any hints!
Stefan
P.S.: This is a repost from
microsoft.public.dotnet.framework.windowsforms