FaultInjection in Windows Server 2008 R2 Enterprise

Apr 7, 2011 at 11:23 AM


I am trying to use the faultInjection feature of TestApi. I´m using WS 2008 R2 entreprise x64 and Visual Studio 2010 ultimate.

I´m trying to launch the example of http://blogs.msdn.com/b/ivo_manolov/archive/2009/11/25/9928447.aspx. First of all, I have to register the FaultInjectionEngine.dll (because I´m not the administrator of the machine), after having registered the library TestAPI throws other exception saying the following:

'Item has already been added. Key in dictionary: 'cor_enable_profiling' Key being added: 'cor_enable_profiling' at FaultSession.cs in SetProcessEnviromentVariables method.

I´ve modified the source code of TestApi in order to control this and at last my test project works.

But  when I launch the example, the program ends and it doesn´t put the fault value during the execution.

Any suggestions?

Apr 8, 2011 at 6:44 AM

1. you can set cor_enable_profiling env to null and the issue should go away. it is caused by incomplete cleanup. i thought this one got fixed already. will check.

2. can you check my blog to see any known issue. http://blogs.msdn.com/b/billliu/archive/2010/05/27/if-it-still-not-working.aspx

3. if still not working, please share the *.log under your working folder.


Apr 8, 2011 at 10:05 AM


I set the cor_enable_profiling to null and I got the same error if I don´t modify the TestApi code.

If I delete the cor_enable_profiling env and I got the same error.

The log shows the following error:

CLR Error: Failed to emit method-ref token for [TestApiCore, version=, Culture=neutral, PublicKeyToken=3d18d97752fc57cc, processorArchitecture=MSIL]Microsoft.Test.FaultInjection.FaultDispatcher.Trap(...).


Apr 12, 2011 at 7:11 AM

hmm, interesting. can you compile into .net 3.5 (both testapi and your test app) to see if it works?

Apr 13, 2011 at 8:13 AM

I've complied everything into .net 3.5. It returns the same error, maybe is something that I´m doing wrong...

May 17, 2011 at 7:22 AM

we identified that there is an issue with fault injection api in the new testapi 0.6 version. while we are working on the fix, please use previous version (v0.5), which worked fine.

note: if you already use or registed 0.6 faultinjectionengine.dll, please use the following command to clean it up before use v0.5.

in command window (run as adminsitrator), goes to folder having faultinjectionengine.dll and run: regsvr32 -u faultinjectionengine.dll

then you should good to go.