I've isolated a bug when testing with the Microsoft Composite Application Block (CAB) libraries:
http://msdn.microsoft.com/practices/default.aspx?pull=/library/en-us/dnpag2/html/cab.asp
It seems that whenever I instantiate a TestableRootWorkItem while the MockManager is running an exception is incorrectly thrown during the ObjectBuilder phase. This exception is not thrown when TypeMock is not running.
After this I sometimes get the following error when trying to build:
Error 1 A problem occurred while trying to set the "Sources" parameter for the IDE's in-process compiler. Attempted to read or write protected memory. This is often an indication that other memory is corrupt. C:WINDOWSMicrosoft.NETFramework2.0.50727Microsoft.CSHARP.Targets 147 9
The only way to clear the error is to shut down VS2005.
Here is the simple test that shows the failure. (I can provide a zip file with the code if needed):
[TestMethod]
public void TestWorkItemFails()
{
MockManager.Init();
// The following incorrectly throws an exception
TestableRootWorkItem mockWorkItem = new TestableRootWorkItem();
mockWorkItem = null;
MockManager.Verify();
}
[TestMethod]
public void TestWorkItemSucceeds()
{
TestableRootWorkItem mockWorkItem = new TestableRootWorkItem();
mockWorkItem = null;
}
Here is the last bits of the TypeMock.out file:
Microsoft.VisualStudio.TestTools.Execution.TimeoutMgr instance void Dispose()
T=>0,M=>0
IL_0 = ldarg.0
IL_1 = ldstr 0x7000235B
IL_2 = ldstr 0x7000249B
IL_3 = ldnull
IL_4 = call 0x0A000158
IL_5 = brfalse.s 0x2B
IL_6 = ldarg.0
IL_7 = ldstr 0x7000235B
IL_8 = ldstr 0x7000249B
IL_9 = ldnull
IL_10 = call 0x0A00015E
IL_11 = dup
IL_12 = ldstr 0x7000235B
IL_13 = ldstr 0x7000249B
IL_14 = call 0x0A00015B
IL_15 = isinst 0x010000BC
IL_16 = brtrue.s 0x02
IL_17 = pop
IL_18 = ret
IL_19 = pop
Thin Header - too small (size=34,insersion=62) converting to Fat
System.Runtime.Remoting.Channels.Ipc.IpcPort instance void Finalize()
T=>0,M=>0
IL_0 = ldarg.0
IL_1 = ldstr 0x7000611C
IL_2 = ldstr 0x70003F18
IL_3 = ldnull
IL_4 = call 0x0A0002AC
IL_5 = brfalse.s 0x2B
IL_6 = ldarg.0
IL_7 = ldstr 0x7000611C
IL_8 = ldstr 0x70003F18
IL_9 = ldnull
IL_10 = call 0x0A0002B0
IL_11 = dup
IL_12 = ldstr 0x7000611C
IL_13 = ldstr 0x70003F18
IL_14 = call 0x0A0002AF
IL_15 = isinst 0x01000153
IL_16 = brtrue.s 0x02
IL_17 = pop
IL_18 = ret
IL_19 = pop
nop
nop
*INFO: SMALL EH clause TryOffset '0x00000000' HandlerOffset '0x00000008' Changed to: TryOffset '0x00000040' HandlerOffset: '0x00000048'
System.Runtime.Remoting.Channels.Ipc.IpcPort instance void Dispose()
T=>0,M=>0
IL_0 = ldarg.0
IL_1 = ldstr 0x7000611C
IL_2 = ldstr 0x70006176
IL_3 = ldnull
IL_4 = call 0x0A0002AC
IL_5 = brfalse.s 0x2B
IL_6 = ldarg.0
IL_7 = ldstr 0x7000611C
IL_8 = ldstr 0x70006176
IL_9 = ldnull
IL_10 = call 0x0A0002B0
IL_11 = dup
IL_12 = ldstr 0x7000611C
IL_13 = ldstr 0x70006176
IL_14 = call 0x0A0002AF
IL_15 = isinst 0x01000153
IL_16 = brtrue.s 0x02
IL_17 = pop
IL_18 = ret
IL_19 = pop
Thin Header - too small (size=34,insersion=62) converting to Fat
Microsoft.VisualStudio.TestTools.Execution.UnmanagedFileMgr instance void Finalize()
T=>0,M=>0
IL_0 = ldarg.0
IL_1 = ldstr 0x700024AB
IL_2 = ldstr 0x70002489
IL_3 = ldnull
IL_4 = call 0x0A000158
IL_5 = brfalse.s 0x2B
IL_6 = ldarg.0
IL_7 = ldstr 0x700024AB
IL_8 = ldstr 0x70002489
IL_9 = ldnull
IL_10 = call 0x0A00015E
IL_11 = dup
IL_12 = ldstr 0x700024AB
IL_13 = ldstr 0x70002489
IL_14 = call 0x0A00015B
IL_15 = isinst 0x010000BC
IL_16 = brtrue.s 0x02
IL_17 = pop
IL_18 = ret
IL_19 = pop
nop
nop
*INFO: SMALL EH clause TryOffset '0x00000000' HandlerOffset '0x00000008' Changed to: TryOffset '0x00000040' HandlerOffset: '0x00000048'
Microsoft.VisualStudio.TestTools.Execution.UnmanagedFileMgr instance void Dispose()
T=>0,M=>0
IL_0 = ldarg.0
IL_1 = ldstr 0x700024AB
IL_2 = ldstr 0x7000249B
IL_3 = ldnull
IL_4 = call 0x0A000158
IL_5 = brfalse.s 0x2B
IL_6 = ldarg.0
IL_7 = ldstr 0x700024AB
IL_8 = ldstr 0x7000249B
IL_9 = ldnull
IL_10 = call 0x0A00015E
IL_11 = dup
IL_12 = ldstr 0x700024AB
IL_13 = ldstr 0x7000249B
IL_14 = call 0x0A00015B
IL_15 = isinst 0x010000BC
IL_16 = brtrue.s 0x02
IL_17 = pop
IL_18 = ret
IL_19 = pop
Thin Header - too small (size=45,insersion=62) converting to Fat