I am trying to make integration test of my application. One of the UI
control is the webbrowser, that has it's own thread for refreshing. It
means the main application is a STA, but the WebBrowser control is not
STA,
that causes the exception below. Are anyways to ignor multithreaded
controls? Thanks.
I.e. NUnit does not throw such exception.
Regards,
Tricky.
The error body:
TestCase 'Test_SubmitCaseDropWorkItem.TestSubmitCaseDropWorkItem'
failed: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot
be instantiated because the current thread is not in a single-threaded
apartment.
System.Threading.ThreadStateException
Message: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot
be instantiated because the current thread is not in a single-threaded
apartment.
Source: System.Windows.Forms
StackTrace:
at System.Windows.Forms.WebBrowserBase..ctor(String clsidString)
at System.Windows.Forms.WebBrowser..ctor()
at SmartClient.Controls.MinimalWebBrowser.InitializeComponent() in
C:\\SmartClient.Controls\WebBrowser\MinimalWebBrowser.Designer.vb:line
24
at SmartClient.Controls.MinimalWebBrowser..ctor() in C:
\SmartClient.Controls\WebBrowser\MinimalWebBrowser.vb:line 11
at
SmartClient.Dropzone.UI.CustomizedContentView.InitializeComponent() in
C:\SmartClient.Dropzone.UI\SubmitCaseDrop\Workitems\Drop\SmartParts
\CustomizedContentView.Designer.vb:line 25
at SmartClient.Dropzone.UI.CustomizedContentView..ctor() C:
\SmartClient.Controls\WebBrowser\MinimalWebBrowser.Designer.vb 24
> I am trying to make integration test of my application. One of the UI
> control is the webbrowser, that has it's own thread for refreshing. It
> means the main application is a STA, but the WebBrowser control is not
> STA,
> that causes the exception below. Are anyways to ignor multithreaded
> controls? Thanks.
> I.e. NUnit does not throw such exception.
> Regards,
> Tricky.
> The error body:
> TestCase 'Test_SubmitCaseDropWorkItem.TestSubmitCaseDropWorkItem'
> failed: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot
> be instantiated because the current thread is not in a single-threaded
> apartment.
> System.Threading.ThreadStateException
> Message: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot
> be instantiated because the current thread is not in a single-threaded
> apartment.
> Source: System.Windows.Forms
> StackTrace:
> at System.Windows.Forms.WebBrowserBase..ctor(String clsidString)
> at System.Windows.Forms.WebBrowser..ctor()
> at SmartClient.Controls.MinimalWebBrowser.InitializeComponent() in
> C:\\SmartClient.Controls\WebBrowser\MinimalWebBrowser.Designer.vb:line
> 24
> at SmartClient.Controls.MinimalWebBrowser..ctor() in C:
> \SmartClient.Controls\WebBrowser\MinimalWebBrowser.vb:line 11
> at
> SmartClient.Dropzone.UI.CustomizedContentView.InitializeComponent() in
> C:\SmartClient.Dropzone.UI\SubmitCaseDrop\Workitems\Drop\SmartParts
> \CustomizedContentView.Designer.vb:line 25
> at SmartClient.Dropzone.UI.CustomizedContentView..ctor() C:
> \SmartClient.Controls\WebBrowser\MinimalWebBrowser.Designer.vb 24
-----Original Message----- From: MbUnitDev@googlegroups.com [mailto:MbUnitDev@googlegroups.com] On
Behalf Of Tricky Sent: Thursday, June 26, 2008 9:00 AM To: MbUnit.Dev Subject: MbUnit Re: single-threaded apartment (STA); MbUnit-2.4.2.130; WebPanel;
I am using the Framework 2.0
Tricky wrote: > Hi,
> I am trying to make integration test of my application. One of the UI > control is the webbrowser, that has it's own thread for refreshing. It > means the main application is a STA, but the WebBrowser control is not > STA, that causes the exception below. Are anyways to ignor > multithreaded controls? Thanks. > I.e. NUnit does not throw such exception.
> Regards, > Tricky.
> The error body:
> TestCase 'Test_SubmitCaseDropWorkItem.TestSubmitCaseDropWorkItem' > failed: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot > be instantiated because the current thread is not in a single-threaded > apartment. > System.Threading.ThreadStateException > Message: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot > be instantiated because the current thread is not in a single-threaded > apartment. > Source: System.Windows.Forms > StackTrace: > at System.Windows.Forms.WebBrowserBase..ctor(String clsidString) > at System.Windows.Forms.WebBrowser..ctor() > at SmartClient.Controls.MinimalWebBrowser.InitializeComponent() in > C:\\SmartClient.Controls\WebBrowser\MinimalWebBrowser.Designer.vb:line > 24 > at SmartClient.Controls.MinimalWebBrowser..ctor() in C: > \SmartClient.Controls\WebBrowser\MinimalWebBrowser.vb:line 11 > at > SmartClient.Dropzone.UI.CustomizedContentView.InitializeComponent() in > C:\SmartClient.Dropzone.UI\SubmitCaseDrop\Workitems\Drop\SmartParts > \CustomizedContentView.Designer.vb:line 25 > at SmartClient.Dropzone.UI.CustomizedContentView..ctor() C: > \SmartClient.Controls\WebBrowser\MinimalWebBrowser.Designer.vb 24
It says 'ApartmentState is not declared'. I added ApartmentState =
System.Threading.ApartmentState.STA.
It looks that there is no such attribute in the version 2.4. What do
you think? Thanks.
On Jun 26, 9:34 pm, "Jeff Brown" <jeff.br...@gmail.com> wrote:
> Add [TestFixture(ApartmentState=ApartmentState.STA)] to your test.
> This is now the default in MbUnit v3.
> Jeff.
> -----Original Message-----
> From: MbUnitDev@googlegroups.com [mailto:MbUnitDev@googlegroups.com] On
> Behalf Of Tricky
> Sent: Thursday, June 26, 2008 9:00 AM
> To: MbUnit.Dev
> Subject: MbUnit Re: single-threaded apartment (STA); MbUnit-2.4.2.130;
> WebPanel;
> I am using the Framework 2.0
> Tricky wrote:
> > Hi,
> > I am trying to make integration test of my application. One of the UI
> > control is the webbrowser, that has it's own thread for refreshing. It
> > means the main application is a STA, but the WebBrowser control is not
> > STA, that causes the exception below. Are anyways to ignor
> > multithreaded controls? Thanks.
> > I.e. NUnit does not throw such exception.
> > Regards,
> > Tricky.
> > The error body:
> > TestCase 'Test_SubmitCaseDropWorkItem.TestSubmitCaseDropWorkItem'
> > failed: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot
> > be instantiated because the current thread is not in a single-threaded
> > apartment.
> > System.Threading.ThreadStateException
> > Message: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot
> > be instantiated because the current thread is not in a single-threaded
> > apartment.
> > Source: System.Windows.Forms
> > StackTrace:
> > at System.Windows.Forms.WebBrowserBase..ctor(String clsidString)
> > at System.Windows.Forms.WebBrowser..ctor()
> > at SmartClient.Controls.MinimalWebBrowser.InitializeComponent() in
> > C:\\SmartClient.Controls\WebBrowser\MinimalWebBrowser.Designer.vb:line
> > 24
> > at SmartClient.Controls.MinimalWebBrowser..ctor() in C:
> > \SmartClient.Controls\WebBrowser\MinimalWebBrowser.vb:line 11
> > at
> > SmartClient.Dropzone.UI.CustomizedContentView.InitializeComponent() in
> > C:\SmartClient.Dropzone.UI\SubmitCaseDrop\Workitems\Drop\SmartParts
> > \CustomizedContentView.Designer.vb:line 25
> > at SmartClient.Dropzone.UI.CustomizedContentView..ctor() C:
> > \SmartClient.Controls\WebBrowser\MinimalWebBrowser.Designer.vb 24
-----Original Message----- From: MbUnitDev@googlegroups.com [mailto:MbUnitDev@googlegroups.com] On
Behalf Of Tricky Sent: Friday, June 27, 2008 1:50 AM To: MbUnit.Dev Subject: MbUnit Re: single-threaded apartment (STA); MbUnit-2.4.2.130; WebPanel;
It says 'ApartmentState is not declared'. I added ApartmentState = System.Threading.ApartmentState.STA. It looks that there is no such attribute in the version 2.4. What do you think? Thanks.
On Jun 26, 9:34 pm, "Jeff Brown" <jeff.br...@gmail.com> wrote: > Add [TestFixture(ApartmentState=ApartmentState.STA)] to your test.
> This is now the default in MbUnit v3.
> Jeff.
> -----Original Message----- > From: MbUnitDev@googlegroups.com [mailto:MbUnitDev@googlegroups.com] > On
> Behalf Of Tricky > Sent: Thursday, June 26, 2008 9:00 AM > To: MbUnit.Dev > Subject: MbUnit Re: single-threaded apartment (STA); MbUnit-2.4.2.130; > WebPanel;
> I am using the Framework 2.0
> Tricky wrote: > > Hi,
> > I am trying to make integration test of my application. One of the > > UI control is the webbrowser, that has it's own thread for > > refreshing. It means the main application is a STA, but the > > WebBrowser control is not STA, that causes the exception below. Are > > anyways to ignor multithreaded controls? Thanks. > > I.e. NUnit does not throw such exception.
> > Regards, > > Tricky.
> > The error body:
> > TestCase 'Test_SubmitCaseDropWorkItem.TestSubmitCaseDropWorkItem' > > failed: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' > > cannot be instantiated because the current thread is not in a > > single-threaded apartment. > > System.Threading.ThreadStateException > > Message: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' > > cannot be instantiated because the current thread is not in a > > single-threaded apartment. > > Source: System.Windows.Forms > > StackTrace: > > at System.Windows.Forms.WebBrowserBase..ctor(String clsidString) > > at System.Windows.Forms.WebBrowser..ctor() > > at SmartClient.Controls.MinimalWebBrowser.InitializeComponent() > > in > > C:\\SmartClient.Controls\WebBrowser\MinimalWebBrowser.Designer.vb:li > > ne > > 24 > > at SmartClient.Controls.MinimalWebBrowser..ctor() in C: > > \SmartClient.Controls\WebBrowser\MinimalWebBrowser.vb:line 11 > > at > > SmartClient.Dropzone.UI.CustomizedContentView.InitializeComponent() > > in > > C:\SmartClient.Dropzone.UI\SubmitCaseDrop\Workitems\Drop\SmartParts > > \CustomizedContentView.Designer.vb:line 25 > > at SmartClient.Dropzone.UI.CustomizedContentView..ctor() C: > > \SmartClient.Controls\WebBrowser\MinimalWebBrowser.Designer.vb > > 24
> I think I might have mispelled it...
> It's in there for sure.
> Jeff.
> -----Original Message-----
> From: MbUnitDev@googlegroups.com [mailto:MbUnitDev@googlegroups.com] On
> Behalf Of Tricky
> Sent: Friday, June 27, 2008 1:50 AM
> To: MbUnit.Dev
> Subject: MbUnit Re: single-threaded apartment (STA); MbUnit-2.4.2.130;
> WebPanel;
> It says 'ApartmentState is not declared'. I added ApartmentState =
> System.Threading.ApartmentState.STA.
> It looks that there is no such attribute in the version 2.4. What do you
> think? Thanks.
> On Jun 26, 9:34 pm, "Jeff Brown" <jeff.br...@gmail.com> wrote:
> > Add [TestFixture(ApartmentState=ApartmentState.STA)] to your test.
> > Behalf Of Tricky
> > Sent: Thursday, June 26, 2008 9:00 AM
> > To: MbUnit.Dev
> > Subject: MbUnit Re: single-threaded apartment (STA); MbUnit-2.4.2.130;
> > WebPanel;
> > I am using the Framework 2.0
> > Tricky wrote:
> > > Hi,
> > > I am trying to make integration test of my application. One of the
> > > UI control is the webbrowser, that has it's own thread for
> > > refreshing. It means the main application is a STA, but the
> > > WebBrowser control is not STA, that causes the exception below. Are
> > > anyways to ignor multithreaded controls? Thanks.
> > > I.e. NUnit does not throw such exception.
> > > Regards,
> > > Tricky.
> > > The error body:
> > > TestCase 'Test_SubmitCaseDropWorkItem.TestSubmitCaseDropWorkItem'
> > > failed: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2'
> > > cannot be instantiated because the current thread is not in a
> > > single-threaded apartment.
> > > System.Threading.ThreadStateException
> > > Message: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2'
> > > cannot be instantiated because the current thread is not in a
> > > single-threaded apartment.
> > > Source: System.Windows.Forms
> > > StackTrace:
> > > at System.Windows.Forms.WebBrowserBase..ctor(String clsidString)
> > > at System.Windows.Forms.WebBrowser..ctor()
> > > at SmartClient.Controls.MinimalWebBrowser.InitializeComponent()
> > > in
> > > C:\\SmartClient.Controls\WebBrowser\MinimalWebBrowser.Designer.vb:li
> > > ne
> > > 24
> > > at SmartClient.Controls.MinimalWebBrowser..ctor() in C:
> > > \SmartClient.Controls\WebBrowser\MinimalWebBrowser.vb:line 11
> > > at
> > > SmartClient.Dropzone.UI.CustomizedContentView.InitializeComponent()
> > > in
> > > C:\SmartClient.Dropzone.UI\SubmitCaseDrop\Workitems\Drop\SmartParts
> > > \CustomizedContentView.Designer.vb:line 25
> > > at SmartClient.Dropzone.UI.CustomizedContentView..ctor() C:
> > > \SmartClient.Controls\WebBrowser\MinimalWebBrowser.Designer.vb
> > > 24