OK, actually I misstated something.  The test I ran trying to create a
simple console app wasn't exactly coded as I expected.  After changing
to what I described, it also failed similar to what the MbUnit
AutoRunner exe was doing.  So this is probably more of a general COM
apartment-threading issue.


On Apr 25, 4:57 pm, gambitx <[EMAIL PROTECTED]> wrote:
> I just started trying out MbUnit to see if it can meet my testing
> requirements.  I have some assemblies that make use of COM components
> via Interop.  However, additionally, I need to avoid registering these
> COM components, so am using manifest files to locate them.
>
> MbUnit has the AutoRunner class, allowing one to change the test
> assembly into a self-contained executable to run those tests.  This
> seems ideal, as it would allow me to create the EXE, add a manifest
> file to it that has all the references for my COM components, and I
> should be good to go.
>
> However, I have tried many different ways to get this to work, and I
> continue to get a System.InvalidCastException when trying to make a
> call on the COM object.  The manifest file does appear to be picked up
> when the exe is loaded .  I thought this could be an apartment-
> threading issue, and have added [STAThread] attribute into Main() as
> well as specifying the test fixture as
> [TestFixture(ApartmentState=ApartmentState.STA)].  However, it didn't
> help.
>
> Some other tests that I have tried are to create a simple console
> application that doesn't use MbUnit, create a thread, mark the thread
> as being STA, and calling the function that uses the COM objects.
> This works just fine.  I'm not sure what else the AutoRunner class
> does and how the EXE generated using MbUnit is different from the
> simple test app that I created.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to