A fix to run Typemock Isolator inside the Page_Load for an ASPX page on VS2010/.NET4

I recently tried to use Typemock Isolator inside a ASP.NET page load event, to fake out some SharePoint SPLists e.g.

protected void Page_Load(object sender, EventArgs e)
     SPSite fakeSite = Isolate.Fake.Instance<SPSite>();

This has worked in the past but using VS2010RC and Isolator it failed.

  • If running VS2010 as Admin I got the error "Could not load file or assembly 'TypeMock, Version=0.12900.25133.13153, Culture=neutral, PublicKeyToken=37342d316331342d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"TypeMock, Version=0.12900.25133.13153, Culture=neutral, PublicKeyToken=37342d316331342d"}"
  • If running as a non admin user I got the error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

Typemock Support told me that I needed to edit the Typemock Isolator’s namespaces.dat file (in its programs directory), this is the file that lists valid test runners. I needed to add WebDev.WebServer40.exe to this file as this is program that makes the call to Isolator to do the faking.

So this is an immediate fix, it is unclear at the moment if this filename WebDev.WebServer40.exe will be the final one for the RTM of 2010, so be prepared for another edit in the future.