chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hi,

We've found TypeMock very useful in Visual Studio, and have been testing out wiring it into the build system. So far, I haven't had any success.

I've installed TypeMock 4.3.1 64-bit with the Evaluation License on a Windows Server 2003 R2 build server. TypeMock tests run fine through VS on that server, but not through Team Build 2008. I've already added the following to my build definition:

-----------------------------------------------------------------
<Import Project="C:Program FilesTypemockIsolator.3TypeMock.MSBuild.Tasks" />

<Target Name="BeforeTest">
<TypeMockStart LogPath="C:TypeMockLogs" LogLevel="9" Target="3.5" />
</Target>

<Target Name="AfterTest">
<TypeMockStop />
</Target>
-----------------------------------------------------------------

The TypeMockStart task runs fine, and I see the following message in the build log:

-----------------------------------------------------------------
Using "TypeMockStart" task from assembly "C:Program FilesTypemockIsolator.3TypeMock.MSBuild.dll".
Task "TypeMockStart"
Typemock Isolator Enterprise License - Maintenance will expire in 15 day(s)
Typemock Isolator Logging to: C:TypeMockLogs
Done executing task "TypeMockStart".
-----------------------------------------------------------------

However, the unit tests still fail with a "Typemock Isolator is not currently enabled" exception. Despite setting the LogPath and LogLevel attributes on the TypeMockStart task, no logs show up.

Finally, TypeMockStop then throws the following exception:

-----------------------------------------------------------------
System.BadImageFormatException: Attempted to load a 64-bit assembly on a 32-bit platform. Use ReflectionOnlyLoad() instead if trying to load for reflection purposes.
File name: 'Configuration, Version=4.3.1.0, Culture=neutral, PublicKeyToken=3dae460033b8d8e2'
at TypeMock.MSBuild.TypeMockStop.Execute()
-----------------------------------------------------------------

Does anyone have any ideas on how to resolve this? TypeMock works great in VS, and we'd like to test it out on the build system before the Eval license expires :)

Thanks!
Laurence
asked by laurencedo (680 points)

4 Answers

0 votes
Hi,

I'd like you to try something that helped a customer before. Commenting out the <TypeMockStop/> tag is a valid workaround if your build script has a single <TypeMockStart> tag, and if you don't use the autodeploy/undeploy feature (which you don't seem to from the excerpt you sent us).
Can you try this, and let us know if you if this is a valid workaround for you.

Thanks in advance,
answered by gilz (14.5k points)
0 votes
Thanks for the quick response.

Unfortunately, removing the TypeMockStop task didn't seem to make any difference. Obviously, I no longer see the BadImageFormatException, but the first two problems remain.

TypeMockStart executes without errors, but the tests fail with "Typemock Isolator is not currently enabled", and no logs show up. I don't see anything in the EventLogs either.

Further help would be greatly appreciated!

Thanks,
Laurence
answered by laurencedo (680 points)
0 votes
Hi Laurence,

We might have a bug in the logging mechanism. :oops:
But let's try to solve the main issue.

I see you don't run the TypemockRegister task before the TypemockStart task. It looks like that:
<Target Name="RegisterTypeMock">
    <TypeMockRegister Company ="XXX" License="XXXX-XXXX-XXXX-XXXX-XXXX" AutoDeploy="True" />
  </Target>


Now, I assumed you don't run it because you have it installed on the build server. I might be wrong, so let's start with the basics:

1. You are using an evaluation license. Make sure it is not expired yet. Use the Typemock Configuration tool (All Programs->Typemock->Isolator 4.3->Typemock Configuration) to make sure.

2. Have 4.3.1. installed on the machine.

3. Add the Register task before the Start task, along with company name and license key as seen in the configuration tool. At this point, set AutoDeploy to false. At this point try running your script.

4. If this doesn't help, we'll try using the AutoDeploy. Set it to true, and add the TypeMockLocation property as described
here. Then try running it again.

Let me know where we stand here, so we can proceed to solve this.

Thanks,
answered by gilz (14.5k points)
0 votes
Yes, I do have TypeMock installed on the build server, with an Enterprise Evaluation license with 13 days left.

Nonetheless, I went ahead and added the TypeMockRegister task

  <Target Name="BeforeTest">
    <TypeMockRegister Company ="21 Day Evaluation" License="91B4-AG6F-47B8-1D0C-1B55" AutoDeploy="false" />
   
    <!-- Start TypeMock -->
    <TypeMockStart LogPath="C:TypeMockLogs" LogLevel="9" Target="3.5" />
  </Target>


Both Register and Start tasks executed successfully, but again, the tests throw a "Typemock Isolator is not currently enabled" exception.

       Using "TypeMockRegister" task from assembly "C:Program FilesTypemockIsolator.3TypeMock.MSBuild.dll".
       Task "TypeMockRegister"
         Typemock Isolator Registered successfully
       Done executing task "TypeMockRegister".
       Using "TypeMockStart" task from assembly "C:Program FilesTypemockIsolator.3TypeMock.MSBuild.dll".
       Task "TypeMockStart"
         Typemock Isolator Enterprise License - Maintenance will expire in 13 day(s)
         Typemock Isolator Logging to: C:TypeMockLogs
       Done executing task "TypeMockStart".


Next, I pulled out the files necessary for autodeploy into a separate folder, then set autodeploy to true.

  <PropertyGroup>
    <TypeMockLocation>C:TypeMock</TypeMockLocation>
  </PropertyGroup>
  
  <Import Project ="$(TypeMockLocation)TypeMock.MSBuild.Tasks"/>

  <Target Name="BeforeTest">
    <TypeMockRegister Company ="21 Day Evaluation" License="91B4-AG6F-47B8-1D0C-1B55" AutoDeploy="True" />
   
    <!-- Start TypeMock -->
    <TypeMockStart LogPath="C:TypeMockLogs" LogLevel="9" Target="3.5" />
  </Target>


Now the TypeMockRegister task hangs, and whenever I run it, I get the following error in the EventLog:

.NET Runtime version 2.0.50727.1433 - Fatal Execution Engine Error (79FFEE24) (80131506)


Thanks for your help,
Laurence
answered by laurencedo (680 points)
...