UnitTesting and ArcObjects 10

Discussion created by yvo.weidmann on Aug 31, 2011
Latest reply on Nov 9, 2012 by LokionNitrox
Dear List

I am trying to use UnitTests with the provided framework within VisualStudio 2010 and ArcGIS (ArcEditor) with C#.

The main problem seems the initializing of the ArcObjects. As soon as I am using an ArcObject object in a test method the following exception is thrown:
System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used.

As first I initialize the ArcObjects environment with a test method defined as [AssemblyInitialize]:
private static AoInitialize aoInitialize;
public static void AssemblyInitialize(TestContext context) {
aoInitialize = new AoInitializeClass();

The license is correctly checked out. But as mentioned, ArcObjects-based objects are throwing the InvalidComObjectException.

I tried several ways of initializing, but till now unsuccessfully.

Does anyone has an idea? I am looking for any hint.

Best regards,