Getting Error When Using Moles RRS feed

  • Question

  • I have a test that uses Moles with Pex 0.22 installed. When I run the test, I see this:

    "The test adapter 'MolesAgentAdapter' threw an exception while running test 'GetValueWithHostType'. could not start Pex host adapter"

    I'm running Pex under VS 2010 Beta 2.

    The test I'm running looks like this:

      public void GetValueWithHostType()
       var dataContext = new SIDataContext();
       dataContext.GetValue = () => { return "Blah"; };
       MDataContext.CurrentGet = () => { return dataContext; };
       Assert.AreEqual("Blah", DataContext.Current.GetValue());

    The code I'm working against is pretty straightfoward.

    If there's anything else I can provide just let me know. This used to work when Stubs/Moles was still around (i.e. before Pex 0.21).

    Monday, February 8, 2010 4:56 AM


All replies

  • Actually, I found two more pieces of information that VS has logged when this test fails:

    Error 2/7/2010 10:56:42 PM [agent] host process failed with ClrMonitorFail (-667) JASONB-VPC-PC
    Error 2/7/2010 10:57:42 PM [agent] wait for host failed (host pid: 184) JASONB-VPC-PC
    Error 2/7/2010 10:57:42 PM [agent] C:\Presentations\What Will Pex Do\WWPD\WWPD\TestResults\JasonB-VPC_JASONB-VPC-PC 2010-02-07 22_56_33\Out>C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\Microsoft.Moles.VsHost.x86.exe "C:\Presentations\What Will Pex Do\WWPD\WWPD\TestResults\JasonB-VPC_JASONB-VPC-PC 2010-02-07 22_56_33\Out\context.tests.dll" /targetx86 JASONB-VPC-PC
    Monday, February 8, 2010 4:59 AM
  • Hi Jason,

    Is there a way to get a standalone repro for this? Could you package a solution to pexbug@microsoft.com?

    Otherwise, you can also try to set the following env.vars and execute mstest in the same command window:

        set molesvshost_diagnostic=1
        set pexvshost_diagnostic=1

    This should increased the amount of logging that goes on in the host and maybe pinpoint the issue.

    Cheers, Peli
    Jonathan "Peli" de Halleux - Give us your input about Pex!
    Monday, February 8, 2010 10:06 AM
  • Weird...

    If I move the two projects to their own solution (Context and Context.Tests), then all the tests passed, including the one that hosts Moles, works. If I run the tests in the solution (which contains other projects), that one fails.

    The only think I can think of that's different is my .sln file was originally done in VS2008. The .sln I created to send to pexbug was done in 2010 B2. Maybe the .sln file has something to do with it? I doubt it ... I'll try creating a new .sln in 2010 that has all the projects in it and see if that fixes it.

    Either way I have something that works for my presentation tomorrow :)

    Oh, I also added those environment variables and I didn't see anything in VS. I probably should've tried to follow your directions and run MSTest from the command line :).

    Monday, February 8, 2010 8:15 PM
  • I ran the tests using mstest.exe and they did work. So ... I'll try remaking my .sln file :)
    Monday, February 8, 2010 8:21 PM
  • Unfortunately, VS and mstest are two different engines. They should work the same but tht's not always true unfortunately. As far as automation goes, we test automatically the mstest path so there might be a bug lurking in the VS-based execution.

    Your scenario is interresting: is it the fact that you have multiple test projects in the same solution that makes it fail?
    Jonathan "Peli" de Halleux - Give us your input about Pex!
    Tuesday, February 9, 2010 1:00 AM
  • That COULD be it. I'm not sure. I'm actually DL'ing RC right now so I'll try this all there when I'm done setting up my new VPC.
    Tuesday, February 9, 2010 2:29 AM
  • Pex 0.22 host type won't work with RC. You'll have to wait for 0.23.

    Jonathan "Peli" de Halleux - Give us your input about Pex!
    Tuesday, February 9, 2010 4:03 AM
  • Yeah, I just noticed that this morning :(

    So...when is 0.23 coming? Any known release date in mind?

    Tuesday, February 9, 2010 4:21 PM
  • It's out...
    Jonathan "Peli" de Halleux - Give us your input about Pex!
    Tuesday, February 16, 2010 7:36 AM