Pex ForumDiscuss and provide feedback on Pex – Automated White Box Testing for .NET© 2009 Microsoft Corporation. All rights reserved.Wed, 25 Nov 2009 07:12:13 Za61cab52-3de6-49bd-ba98-c269e5ad3c93http://social.msdn.microsoft.com/Forums/en-US/pex/thread/f618a9bc-7298-4fb5-b8a6-204bbda1eadfhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/f618a9bc-7298-4fb5-b8a6-204bbda1eadfMichael Damatovhttp://social.msdn.microsoft.com/Profile/en-US/?user=Michael%20DamatovShouldn't Pex-generated test fail?<div style="background-color:white;color:black"> <pre><span style="color:blue">public</span> <span style="color:blue">static</span> IEnumerable&lt;A&gt; GetAs(IEnumerable&lt;Base&gt; bases) { Contract.Requires(bases != <span style="color:blue">null</span>); Contract.Requires(Contract.ForAll(bases, x =&gt; x != <span style="color:blue">null</span>)); Contract.Ensures(Contract.Result&lt;IEnumerable&lt;A&gt;&gt;() != <span style="color:blue">null</span>); Contract.Ensures(Contract.ForAll(Contract.Result&lt;IEnumerable&lt;A&gt;&gt;(), a =&gt; a != <span style="color:blue">null</span>)); <span style="color:blue">return</span> <span style="color:blue">from</span> item <span style="color:blue">in</span> bases <span style="color:blue">let</span> a = item <span style="color:blue">as</span> A <span style="color:blue">where</span> a != <span style="color:blue">null</span> <span style="color:blue">select</span> a; } <span style="color:blue">public</span> <span style="color:blue">static</span> IEnumerable&lt;A&gt; GetAs() { Contract.Ensures(Contract.Result&lt;IEnumerable&lt;A&gt;&gt;() != <span style="color:blue">null</span>); Contract.Ensures(Contract.ForAll(Contract.Result&lt;IEnumerable&lt;A&gt;&gt;(), a =&gt; a != <span style="color:blue">null</span>)); <span style="color:blue">var</span> list = <span style="color:blue">new</span> List&lt;Base&gt; { <span style="color:blue">null</span>, <span style="color:blue">null</span> }; <span style="color:blue">return</span> GetAs(list); } </pre> </div> The Pex (0.19.41110.1) generates tests and means that the second method would work! Obviously code contracts of the first method are violated when the first method is called from the second method. Following classes are used:<br/><br/> <div style="background-color:white;color:black"> <pre><span style="color:blue">abstract</span> <span style="color:blue">class</span> Base {} <span style="color:blue">class</span> A : Base {} <span style="color:blue">class</span> B : Base {} </pre> </div>Tue, 24 Nov 2009 10:21:39 Z2009-11-25T07:12:13Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/b4281544-e9e3-4d22-bc7a-7eb240402b8bhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/b4281544-e9e3-4d22-bc7a-7eb240402b8btfulhttp://social.msdn.microsoft.com/Profile/en-US/?user=tfulMoles and Stubs vs. Moq<p>Given that Moles and Stubs can accomplish a lot, doesn't it make sense to add the remaining Moq features as well to Pex? if not, why?</p>Sun, 15 Nov 2009 23:41:05 Z2009-11-25T06:26:00Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/7d55d0d9-512f-4863-a11f-db1186f31bc7http://social.msdn.microsoft.com/Forums/en-US/pex/thread/7d55d0d9-512f-4863-a11f-db1186f31bc7dougawahttp://social.msdn.microsoft.com/Profile/en-US/?user=dougawaHow to refactor tests that use AsStub helper<p>From the &quot;0.19&quot; release notes: <br/><br/><em>No more AsStub and AsMole: the AsStub and AsMole helpers were confusing and pretty useless so we decided to reduce the amount of generated code by removing them.<br/><br/></em>We have some tests that use the AsStub helper.  How do you advise updating these tests to work with the 0.19 release? <br/><br/>Thank you!</p>Tue, 24 Nov 2009 23:37:51 Z2009-11-25T00:23:03Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/0a03bcfd-0f74-4ed8-a45d-ef9f64f48b13http://social.msdn.microsoft.com/Forums/en-US/pex/thread/0a03bcfd-0f74-4ed8-a45d-ef9f64f48b13Waldek Mastykarzhttp://social.msdn.microsoft.com/Profile/en-US/?user=Waldek%20MastykarzCreating Parameterized Moles returns null Mole only<p>I was working on a demo on using Pex with SharePoint and stumbled upon the following challenge.</p> <p>Imagine the following code:</p> <pre lang="x-c#">public static SPListItem GetNewsMessage(string title) { SPListItem newsMessage = null; if (String.IsNullOrEmpty(title)) { throw new ArgumentException(&quot;title&quot;); } SPList newsList = SPContext.Current.Web.Lists[&quot;Pages&quot;]; if (newsList != null) { SPListItemCollection newsItems = newsList.GetItems(new SPQuery() { Query = String.Format(&quot;&lt;Where&gt;&lt;And&gt;&lt;Eq&gt;&lt;FieldRef Name='ContentType'/&gt;&lt;Value Type='Text'&gt;News&lt;/Value&gt;&lt;/Eq&gt;&lt;Eq&gt;&lt;FieldRef Name='Title'/&gt;&lt;Value Type='Text'&gt;{0}&lt;/Value&gt;&lt;/Eq&gt;&lt;/And&gt;&lt;/Where&gt;&lt;OrderBy&gt;&lt;FieldRef Name='Created' Ascending='True'/&gt;&lt;/OrderBy&gt;&quot;, title), RowLimit = 1 }); if (newsItems != null &amp;&amp; newsItems.Count &gt; 0) { newsMessage = newsItems[0]; } } return newsMessage; } </pre> <p>It's a method that returns a list item with the given title.</p> <p>The problem is that Pex doesn't generate any test to cover the case when an item is found (ie. newsItems != null &amp;&amp; newsItems.Count &gt; 0). The mock of the GetItems(SPQuery) method always results in a null value. While I could create two PexMethods to cover this I'd rather use a single method with parameterized mole.</p> <p>I've looked at the documentation provided with Pex and came up with the following PexMethod:</p> <pre lang="x-c#">[PexMethod] public SPListItem GetNewsMessage(string title) { MSPContext.FallbackAsNotImplemented(); MSPContext.CurrentGet = () =&gt; new MSPContext() { WebGet = () =&gt; new MSPWeb() { ListsGet = () =&gt; new MSPListCollection() { ItemGetString = listName =&gt; { PexAssert.IsTrue(listName == &quot;Pages&quot;); return new MSPList() { GetItemsSPQuery = query =&gt; { PexAssert.IsNotNull(query); var call = PexChoose.FromCall(this); return call.ChooseResult&lt;MSPListItemCollection&gt;(); } }; } } } }; SPListItem result = RecentNewsWebPart.GetNewsMessage(title); return result; // TODO: add assertions to method RecentNewsWebPartTest.GetNewsMessage(String) } </pre> <p>Unfortunately, as I mentioned before, the GetItemsSPQuery method always returns a null value.</p> <p>Am I missing something here, or is this something SharePoint-specific that isn't supported by Pex yet?</p><hr class="sig">w: <a href="http://blog.mastykarz.nl">http://blog.mastykarz.nl</a> | t: <a href="http://twitter.com/waldekm">@waldekm</a> | c: <a href="http://imtech.codeplex.com">http://imtech.codeplex.com</a> | c: <a href="http://www.imtechvelocity.nl/">http://www.imtechvelocity.nl</a>Mon, 23 Nov 2009 15:29:17 Z2009-11-24T17:31:54Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/a43db405-fd98-446b-9754-626daafcdd02http://social.msdn.microsoft.com/Forums/en-US/pex/thread/a43db405-fd98-446b-9754-626daafcdd02GeoffreyKhttp://social.msdn.microsoft.com/Profile/en-US/?user=GeoffreyKPex doesn't appear to honor PexAllowedException attribute.<p>I have some test that were throwing exceptions that were expected, and I used the Allow Exception option in the Pex Exploration Results window, and I can see my code that it now reads:<br/><span style="font-size:x-small">[</span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">PexMethod</span></span><span style="font-size:x-small">, </span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">PexAllowedException</span></span><span style="font-size:x-small">(</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">typeof</span></span><span style="font-size:x-small">(</span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">NullReferenceException</span></span><span style="font-size:x-small">))]<font size=2> <p> </p> </font></span></p> <p><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">public</span></span><span style="font-size:x-small"> </span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">UpgradeType</span></span><span style="font-size:x-small"> CheckRequiredParameters(</span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">CommandLineArguments</span></span><span style="font-size:x-small"> parsedArguments) <p>{<br/>...<br/><br/>but when I run the test again using MSTest I still get NullReferenceExceptions.  Am I missing something to make the exception allowed?  I'm using Pex 0.18.41014.0, and VS 2008 Team Suite.<br/><br/>Thanks,<br/>--Geoff</p> </span></p><hr class="sig">Thanks, --GeoffTue, 10 Nov 2009 15:32:59 Z2009-11-24T09:33:46Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/fd830d0d-63e5-453d-901d-021baac7646bhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/fd830d0d-63e5-453d-901d-021baac7646bneonicholasihttp://social.msdn.microsoft.com/Profile/en-US/?user=neonicholasiHow to mock a SerialPort with events?Hi, me again.<br/><br/><br/>I'm still trying pex on the application involving communications through SerialPorts.<br/><br/>Now I'm faced of the case that when SerialPort.write is used to send a command, we know what is the expected return message if the other side of the communication is working properly. And my program simply listen to the DataReceived event of the port and act corresponding.<br/><br/>So that I wrapped the write() method of SerialPort and want to raise a DataReceived event at the end to notify the program under test, it looks like:<br/> <div style="background-color:white;color:black"> <pre><span style="color:green">//WriteString is the mole of SerialPort.write(String s)</span> MSerialPort.AllInstances.WriteString = (writer, s) =&gt; { <span style="color:green">//do something that I need to map the command s with its expected response;</span> <span style="color:green">//TODO: raise a DataReceived event so that the handler of the program can be invoked.</span> }; </pre> </div> <br/>Currently I'm applying a wrapper of the handler in my test (because it is private) so that I can invoke it in my PUT, but that does not seem a good solution since it provides a potential to change the behavior of the program under test. <br/><br/>Would you sharing some ideas about this problem?<br/><br/>Thanks.<br/><br/><br/><br/><br/><br/><br/><br/>Tue, 10 Nov 2009 19:37:19 Z2009-11-24T09:32:23Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/7dbf28c5-7b1c-440a-b807-5816c854b539http://social.msdn.microsoft.com/Forums/en-US/pex/thread/7dbf28c5-7b1c-440a-b807-5816c854b539xor88http://social.msdn.microsoft.com/Profile/en-US/?user=xor88Does mole generation skip abstract properties and methods of an abstract class?<span style="font-family:Arial;font-size:13px;white-space:pre">Does mole generation skip abstract properties and methods of an abstract class? How to enable that? I cannot use stubs for this task because i need to change</span> <div><span style="font-family:Arial;font-size:13px;white-space:pre">sealed methods as well.</span></div>Sat, 21 Nov 2009 22:39:29 Z2009-11-23T22:54:50Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/1b61e68e-5603-42ea-9ed4-8d74bdbce15bhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/1b61e68e-5603-42ea-9ed4-8d74bdbce15bWaldek Mastykarzhttp://social.msdn.microsoft.com/Profile/en-US/?user=Waldek%20MastykarzError while executing a test from the Test View: Host process failed with exit code ClrMonitorFail<p>Executing a test from the Test View window results in the following exception:<br/><br/>Error 11/23/2009 10:35:31 AM !error! [agent] host process failed with exit code ClrMonitorFail (-667) WINDOWS7<br/>Error 11/23/2009 10:35:31 AM !error! [agent] host exited before connecting WINDOWS7<br/>Error 11/23/2009 10:35:31 AM !error! [agent] failed to start Pex Host for GetNewsMessage_NewsFound_SPListItem03 (in ....\projects\pextest.classlibrary7\classlibrary7.tests\bin\debug\classlibrary7.tests.dll) WINDOWS7<br/><br/>This exception occurs only when the Code Coverage has been enabled in Local.testsettings.</p><hr class="sig">w: <a href="http://blog.mastykarz.nl">http://blog.mastykarz.nl</a> | t: <a href="http://twitter.com/waldekm">@waldekm</a> | c: <a href="http://imtech.codeplex.com">http://imtech.codeplex.com</a> | c: <a href="http://www.imtechvelocity.nl/">http://www.imtechvelocity.nl</a>Mon, 23 Nov 2009 09:40:55 Z2009-11-23T17:03:49Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/9196fd9c-7562-44cc-af55-b4b4695b9cd6http://social.msdn.microsoft.com/Forums/en-US/pex/thread/9196fd9c-7562-44cc-af55-b4b4695b9cd6Waldek Mastykarzhttp://social.msdn.microsoft.com/Profile/en-US/?user=Waldek%20MastykarzAdding Precondition doesn't take the framework version into accountAdding Precondition to a 3.5 Framework Assembly, adds the Contract.Requires statement which belongs to the 4.0 Framework.<hr class="sig">w: <a href="http://blog.mastykarz.nl">http://blog.mastykarz.nl</a> | t: <a href="http://twitter.com/waldekm">@waldekm</a> | c: <a href="http://imtech.codeplex.com">http://imtech.codeplex.com</a> | c: <a href="http://www.imtechvelocity.nl/">http://www.imtechvelocity.nl</a>Mon, 23 Nov 2009 10:31:59 Z2009-11-23T16:30:51Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/0901cdf0-6a41-4125-9be5-f2915cec1b85http://social.msdn.microsoft.com/Forums/en-US/pex/thread/0901cdf0-6a41-4125-9be5-f2915cec1b85Nikolai Tillmannhttp://social.msdn.microsoft.com/Profile/en-US/?user=Nikolai%20TillmannMeaning of "Allow Exception..." menu itemI got the following feedback from Manuel Fahndrich. In addition to adding a PexAllowedExceptionAttribute, it should also re-classify all generated test cases, turning &quot;unexpectedly raised exceptions&quot; into &quot;expected exception&quot;.<br/><br/>Does anyone else have opinions about this feature in Pex?<hr class="sig"> <hr> Nikolai Tillmann - <a href="http://social.msdn.microsoft.com/Forums/en/pex/thread/27c703ea-3928-41ef-b767-638c39966b99">Tell us how you use Pex</a>Thu, 19 Nov 2009 04:54:43 Z2009-11-21T21:55:00Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/ba9de9ce-56d3-48cc-836b-d546bf8e1a9ehttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/ba9de9ce-56d3-48cc-836b-d546bf8e1a9eMichael Weisshttp://social.msdn.microsoft.com/Profile/en-US/?user=Michael%20WeissPex always crashes with StackOverflowHi,<br/><br/>after running Pex on a method it constantly crashes. A window pops up saying &quot;Microsoft Pex Exploration Host funktioniert nicht mehr&quot; (in english something like: &quot;Microsoft Pex Exploration Host doesn't work anymore&quot;). The error message in the Pex Exporation Results Window says: &quot;Review Bold Issuses: (!) StackOverflow&quot;. This happens every time I run Pex on a method, even in very simple test applications (empty console application with just a single method).<br/><br/>I don't know if there is a correlation but it seems to me, as if the problem appeared after installing Code Contracts. But now even after uninstalling Code Contracts the problem persits.<br/><br/>I am using: Windows 7 (32bit), VS 2008 Proffesional, Pex 0.19.411101.1<br/><br/>Thank You<br/>MichaelSat, 21 Nov 2009 14:04:18 Z2009-11-21T19:19:34Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/0d129180-e8b6-4235-9391-a6a28f0e37cfhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/0d129180-e8b6-4235-9391-a6a28f0e37cfxor88http://social.msdn.microsoft.com/Profile/en-US/?user=xor88Stubs not working after Upgrade from 0.17 to 0.19I have delete the old stub file and added a new one: <div><br/></div> <div> <div style="color:Black;background-color:White"> <pre>&lt;?xml version=<span style="color:#A31515">&quot;1.0&quot;</span> encoding=<span style="color:#A31515">&quot;utf-8&quot;</span> ?&gt; &lt;!-- This file <span style="color:Blue">is</span> used <span style="color:Blue">by</span> Microsoft.Stubs to generate stubs and moles <span style="color:Blue">for</span> all the types <span style="color:Blue">in</span> the assembly under test. --&gt; &lt;Stubs xmlns=<span style="color:#A31515">&quot;http://schemas.microsoft.com/stubs/2008/&quot;</span>&gt; &lt;Assembly Name=<span style="color:#A31515">&quot;Tracker&quot;</span> /&gt; &lt;/Stubs&gt; </pre> </div> <br/></div> <div>When i compile or do &quot;Run custom Tool&quot;, the generated .designer.cs is empty. No error messages related to stubs are shown. However the project containing the .stubx currently does not compile. What am i doing wrong here?</div> <div><br/></div>Fri, 20 Nov 2009 15:47:13 Z2009-11-21T22:26:17Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/a40fef65-9a53-4ea7-bb52-7a93b4f2738dhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/a40fef65-9a53-4ea7-bb52-7a93b4f2738dYauhen Safrankouhttp://social.msdn.microsoft.com/Profile/en-US/?user=Yauhen%20SafrankouStubs and Moles generation for internal visible classesHello,<br/><br/>With the latest version of Pex (v0.19.41110.1 DevLabs Pre Release for commercial evaluation) some stuff started working differently. Particularly with the latest version I cannot get stubs and moles for internal classes visible for a test project.<br/><br/>The case:<br/>- a class library &quot;ClassLibrary&quot; has two classes: one public and one internal;<br/>- &quot;ClassLibrary&quot; has an attribute applied in the AssemblyInfo.cs<br/>    [assembly: InternalsVisibleTo(&quot;TestProject&quot;)]<br/>- &quot;TestProject&quot; is my VS test project;<br/>- &quot;TestProject&quot; has ClassLibrary.stubx with the following content<br/>    &lt;Stubs xmlns=&quot;<a href="http://schemas.microsoft.com/stubs/2008/">http://schemas.microsoft.com/stubs/2008/</a>&quot;&gt;<br/>      &lt;Assembly Name=&quot;ClassLibrary&quot; /&gt;<br/>    &lt;/Stubs&gt;<br/>- Stubs generate stubs and moles only for the public class from &quot;ClassLibrary&quot;.<br/><br/>Stubs v0.18.41014.0 definitely generated stubs/moles for my internal classes visible inside a test project.<br/><br/>Is it a bug or stubs/moles generation of internal visible classes was removed?<br/><br/>Thanks.<br/><br/>--YauhenFri, 20 Nov 2009 13:01:41 Z2009-11-20T19:02:59Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/51c058a1-2ea5-4e7a-a38b-698bd7db025chttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/51c058a1-2ea5-4e7a-a38b-698bd7db025csjhukhttp://social.msdn.microsoft.com/Profile/en-US/?user=sjhukNew to Unit TestingHi, I have a couple of questions.<br/><br/>Say I have a person class:<br/><br/>Person<br/>{<br/>private string firstName;<br/>private string lastName;<br/>public string GetName()<br/>{<br/>return lastName + &quot;, &quot; + firstName;<br/>}<br/><br/>I really want to run this against the &quot;Person&quot; object, so I want PEX to generate random people with random names and check the output. Obviously this is a simple example.<br/><br/>PEX seems to just create a new Person {} object, i.e. everything set to null. I kind of expected this, however, I would like to specify some Person objects of my own. Can I add additional cases over the ones that PEX finds?<br/><br/>Let me know if I'm doing it wrong<br/><br/>Regards,<hr class="sig">sjhThu, 19 Nov 2009 22:48:46 Z2009-11-20T10:57:02Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/42d7de7b-b7af-4d52-8208-729f0d3c2e2chttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/42d7de7b-b7af-4d52-8208-729f0d3c2e2cDetroitProhttp://social.msdn.microsoft.com/Profile/en-US/?user=DetroitProDisable Partial GenerationIs it possible to have PEX generate non-partial classes? I'd like to generate using PEX once and then hand craft my tests.Thu, 19 Nov 2009 15:01:44 Z2009-11-23T00:10:12Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/aff08c0f-e19e-438e-83cc-610348ea4adehttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/aff08c0f-e19e-438e-83cc-610348ea4adeaL3891http://social.msdn.microsoft.com/Profile/en-US/?user=aL3891pex host type and vs2010hello<br/>ive been having some trouble getting my moles to work again after moving to 2010, i found in the docs that only vs2008 is supported but is this still true for 0.19? <br/>since the mole api has changed a little im not sure if im doing some misstake and thats why my moles doesnt get called, or if its because vs2010 is not playing nice with the pex hostTue, 17 Nov 2009 10:25:47 Z2009-11-19T14:45:05Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/e86a14e1-af30-4a68-9760-e64bdb725df5http://social.msdn.microsoft.com/Forums/en-US/pex/thread/e86a14e1-af30-4a68-9760-e64bdb725df5sandrews-tblhttp://social.msdn.microsoft.com/Profile/en-US/?user=sandrews-tblVS2010 IssueI must have done something incorrect.  I have a Win7 dev machine (x86) with both Visual Studio 2008 professional and Visual Studio 2010 Ultimate Beta 2 installed.  I installed the latest version of Pex this morning and am able to successfully use it with VS2008.  With VS2010, anytime I use Pex (with either an exisiting or new project) I get this message in the output:<br/><br/><span style="font-family:Consolas;font-size:xx-small"><span style="font-family:Consolas;font-size:xx-small"> <p>launching pex</p> <p>starting...</p> <p>C:\Users\sandrews\documents\visual studio 2010\Projects\TestApplication\TestApplication\bin\Debug\TestApplication.exe</p> <p>&quot;C:\Program Files\Microsoft Pex\bin\Microsoft.Pex.exe&quot; &quot;C:\Users\sandrews\documents\visual studio 2010\Projects\TestApplication\TestApplication\bin\Debug\TestApplication.exe&quot; /membernamefilter:M:Capitalize! /namespacefilter:TestApplication! /typefilter:Helper! /explorationreflectionmode:Wizard /x64failsilently /assemblyresolutiondirectories:&quot;C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies&quot; /targetclrversion:v2.0.50727 /targetclrversion2 /donotopenreport /reportlevel:None /reportrootpath:&quot;C:\Users\sandrews\documents\visual studio 2010\Projects\TestApplication\TestApplication\bin\Debug\reports&quot; /testassemblyname:TestApplication.Tests /testframework:VisualStudioUnitTest /testlanguage:cs /testprojectfile:&quot;C:\Users\sandrews\documents\visual studio 2010\Projects\TestApplication\TestApplication\TestApplication.csproj&quot; /testprojectnotupdate /testprojectskip</p> <p>launching new pex process</p> <p>starting monitored process</p> <p>listening to monitored process (cold start)</p> <p>launched Pex 0.19.41110.1 x86 Edition on .NET v2.0.50727</p> <p>00:00:00.0&gt; starting execution</p> <p>00:00:00.0&gt; reflecting tests</p> <p><strong><em>!error! [metadata] bad image format encountered while loading explorations</em></strong></p> <p><strong><em>[symbols] could not load symbols for C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll</em></strong></p> <p>[symbols] search path:</p> <p>00:00:00.8&gt; [finished] execution time 00:00:00.7620000.</p> <p>-- 0 critical errors, 1 errors, 0 warnings.</p> <p>-- 0 generated tests, 0 failing, 0 new, 0 inconclusive.</p> <p>[coverage] skipping coverage reports...</p> <p>[reports] skipping html reports</p> <p>EXPLORATION FAILED</p> <p> </p> <p>monitored process exited with ReflectionError (-1011)</p> <p>finished</p> </span></span>Wed, 18 Nov 2009 16:06:24 Z2009-11-19T14:42:47Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/f8087caf-8a56-49e5-803f-ba4dcd394734http://social.msdn.microsoft.com/Forums/en-US/pex/thread/f8087caf-8a56-49e5-803f-ba4dcd394734Kunal Tanejahttp://social.msdn.microsoft.com/Profile/en-US/?user=Kunal%20TanejaQuestion Regarding PexSymbolicValue.GetRelevantInputNames<div>Hi,</div> <div><br/></div> I was trying to use the method <em>PexSymbolicValue</em>.<span style="font-family:Arial;font-size:13px;white-space:pre"><em>GetRelevantInputNames</em> to get the inputs that influence the value of a variable.</span> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre">It seems that the method returns the inputs considering both control-flow and data-flow.</span></span></div> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre">Is it possible to get inputs based on control-flow only and data-flow only?</span></span></div> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre"><br/></span></span></div> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre">In addition, if an array <em>A</em> is an input and value of a variable <em>V</em><strong> </strong>is dependent only on the first (say) element of the array <em>A</em>, </span></span></div> <div><span style="font-family:Arial;font-size:13px;white-space:pre">the method <span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;white-space:normal"><em>PexSymbolicValue</em>.<span style="font-family:Arial;font-size:13px;white-space:pre"><em>GetRelevantInputNames(V) </em>returns<em> &quot;A&quot; and &quot;$Items&quot;. </em></span></span></span></div> <div><span style="font-family:Arial;font-size:13px;white-space:pre"><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;white-space:normal"><span style="font-family:Arial;font-size:13px;white-space:pre">Is it possible to precisely get the<em> <span style="font-style:normal">element of<em> </em><em>A</em><em> <span style="font-style:normal">(i.e., A[0]) on which <em>V</em> depends?</span></em></span></em></span></span></span></div> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre"><em><br/></em></span></span></div> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre">Best Regards,</span></span></div> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre">Kunal</span></span></div> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre"><br/></span></span></div>Tue, 10 Nov 2009 05:00:56 Z2009-11-19T04:34:03Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/7e6c26df-ccfb-48a4-878d-b3b01f5ba8d5http://social.msdn.microsoft.com/Forums/en-US/pex/thread/7e6c26df-ccfb-48a4-878d-b3b01f5ba8d5Pelihttp://social.msdn.microsoft.com/Profile/en-US/?user=PeliBlogging about Pex, let us know!<strong>If you are (or you've been) blogging about Pex</strong>, let us know and drop the link in this thread. We are building a list of links that will be hosted our project web site.<br/><br/>Your feedback is crucial for us!Wed, 20 May 2009 14:22:47 Z2009-11-18T17:20:59Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/52b1e77f-4ca5-4441-8eb4-4f2b823ec165http://social.msdn.microsoft.com/Forums/en-US/pex/thread/52b1e77f-4ca5-4441-8eb4-4f2b823ec165Waldek Mastykarzhttp://social.msdn.microsoft.com/Profile/en-US/?user=Waldek%20MastykarzPex: Visual Studio Addin 0.19.41110.1 crashed with System.InvalidOperationExceptionPex Visual Studio add-in crashes while starting Visual Studio.<br/><br/> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">Pex 0.19.41110.1 Release Visual Studio 10.0.21006.1 Bug Report</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">------------------------------------------</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">- Open Visual Studio 2010</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">- Open the Pex Exploration Tool Window</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">- Dock it to the bottom</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">- Make sure it's activated</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">- Close Visual Studio 2010</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">- Open Visual Studio 2010</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">- The exception occurs</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-family:Segoe UI;font-size:x-small"> </span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">------------------------------------------</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">exception details:</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">System.InvalidOperationException: The DocumentSite on a WindowFrame may only be set once</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI"><span style="">   </span>at</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.set_DocumentSite(DocumentObjectSite</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">value)</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI"><span style="">   </span>at</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.CreateContentPane(String</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">pszName, Int32 fDockViewOn, Int32 fDocument, String lpstrMkDoc, UInt32 eCreateWindowFlags, UInt32 dwToolWinId, Object punkView, Object punkData, IServiceProvider pServiceProvider, IVsUIHierarchy pUIHierarchy, UInt32 vsid, Int32&amp; pfDefaultPosition, Guid&amp; rguidCmdUI, IVsWindowFrame&amp; ppWindowFrame)</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI"><span style="">   </span>at</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">errorCode, IntPtr errorInfo)</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI"><span style="">   </span>at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">errorCode)</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI"><span style="">   </span>at Microsoft.VisualStudio.NativeMethods.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure)</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI"><span style="">   </span>at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">toolWindowType, Int32 id, ProvideToolWindowAttribute tool)</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI"><span style="">   </span>at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">toolWindowType, Int32 id)</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI"><span style="">   </span>at Microsoft.VisualStudio.Shell.Package.FindToolWindow(Type</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">toolWindowType, Int32 id, Boolean create, ProvideToolWindowAttribute</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI">tool)</span></span></p> <p class=MsoPlainText style="margin:0cm 0cm 0pt"><span style="font-size:x-small"><span style="font-family:Segoe UI"><span style="">   </span>at Microsoft.Pex.VsPackage.PEX.InitializeExplorationExplorerWindow()</span></span></p> <span style="font-family:'Calibri','sans-serif';font-size:11pt"><span style="">   </span>at Microsoft.Pex.VsPackage.PEX.IntializePackage()</span><hr class="sig">w: <a href="http://blog.mastykarz.nl">http://blog.mastykarz.nl</a> | t: <a href="http://twitter.com/waldekm">@waldekm</a> | c: <a href="http://imtech.codeplex.com">http://imtech.codeplex.com</a> | c: <a href="http://www.imtechvelocity.nl/">http://www.imtechvelocity.nl</a>Fri, 13 Nov 2009 06:40:52 Z2009-11-17T10:22:36Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/7516273b-9192-42a0-857e-7394c50763b0http://social.msdn.microsoft.com/Forums/en-US/pex/thread/7516273b-9192-42a0-857e-7394c50763b0nanhuacrabhttp://social.msdn.microsoft.com/Profile/en-US/?user=nanhuacrabhow to generate MDateTime class?<span style="font-family:Verdana;font-size:10px;color:#666666;line-height:15px;white-space:pre-wrap"> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">how to run the code? Can't find MDateTime, if i must change the PexAssemblyInfo.cs file, and so, how to do?</div> <img style="font-weight:inherit;font-style:inherit;font-family:inherit;list-style-type:none;text-decoration:none;padding:0px;margin:0px;border:initial none initial" src="http://research.microsoft.com/en-us/projects/stubs/y2kbug.png" alt=""></span>Mon, 16 Nov 2009 03:36:54 Z2009-11-17T00:38:44Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/ed54329f-6cf0-47a5-b00c-61b8dbea414fhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/ed54329f-6cf0-47a5-b00c-61b8dbea414faL3891http://social.msdn.microsoft.com/Profile/en-US/?user=aL3891Pex generates empty stub file for one projecthello guys<br/>all of a sudden pex doesnt generate any stubs for one of my projects. i havent changed the stubx file and it works fine for other projects in the same solution but not this one. i havent changed anything in the project when it stopped working except that i added a reference to another project, but even after i removed that reference i only get the following in the generated file:<br/><br/> <div style="background-color:white;color:black"> <pre><span style="color:green">// &lt;auto-generated/&gt;</span> <span style="color:blue">#pragma</span> warning disable 0067, 0108, 0618 [<span style="color:blue">assembly</span>: global::Microsoft.Stubs.Framework.StubsAssembly(<span style="color:#a31515">&quot;CoreNetLib&quot;</span>)] </pre> </div> <br/>the stubx file looks like this <br/> <div style="background-color:white;color:black"> <pre><span style="color:blue">&lt;?</span><span style="color:#a31515">xml</span> <span style="color:red">version</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">1.0</span><span style="color:black">&quot;</span> <span style="color:red">encoding</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">utf-8</span><span style="color:black">&quot;</span> <span style="color:blue">?&gt;</span> <span style="color:green">&lt;!-- This file is used by Microsoft.Stubs to generate stubs for all the interfaces in the assembly under test. --&gt;</span> <span style="color:blue">&lt;</span><span style="color:#a31515">Stubs</span> <span style="color:red">xmlns</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue"><a href="http://schemas.microsoft.com/stubs/2008/&quot;&gt;">http://schemas.microsoft.com/stubs/2008/</a> <span style="color:blue">&lt;</span><span style="color:#a31515">Assembly</span> <span style="color:red">Name</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">CoreNetLib</span><span style="color:black">&quot;</span> <span style="color:blue">/&gt;</span> <span style="color:blue">&lt;/</span><span style="color:#a31515">Stubs</span><span style="color:blue">&gt;</span> </span><span style="color:black">&quot;</span><span style="color:blue">&gt;</span> </pre> </div> i dont get any errors from the stub generation either, acording to the stub output its doing the generation, it just results in nothing. all projects in the solution build.<br/><br/>is there any other place i can look for errors?Mon, 09 Nov 2009 16:38:02 Z2009-11-14T14:33:12Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/483c5fe4-1976-4b28-9fdc-15aecd19b41ahttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/483c5fe4-1976-4b28-9fdc-15aecd19b41aJudahhttp://social.msdn.microsoft.com/Profile/en-US/?user=JudahNullReferenceException - bug in Pex?I have a PUT that, when run under Pex Exploration, throws a NullReferenceException: <div><br/></div> <div><br/></div> <img src="http://judahsoftware.com/images/PexNullReferenceException.jpg" alt=""> <div><br/></div> <div><br/></div> <div>As you can see, the stack trace is rather unhelpful, it doesn't show where the actual error is occurring. Clicking &quot;Go To&quot; just takes me to the PUT, and that PUT isn't throwing any null reference exceptions.</div> <div><br/></div> <div>Here's my PUT:</div> <div><br/></div> <div> <div style="color:Black;background-color:White"> <pre>[PexMethod] <span style="color:Blue">public</span> <span style="color:Blue">void</span> CommitCurrentTransactions_CausesSharedItemsToBeFlushedToDisk( [PexAssumeUnderTest, PexAssumeNotNull] SharedIndexing target) { <span style="color:Blue">var</span> sharedIds = <span style="color:Blue">new</span>[] { Guid.NewGuid() }; target.SetSharedState(sharedIds, <span style="color:Blue">true</span>); } </pre> </div> <br/></div> <div><br/></div> <div>And here's SetSharedState:</div> <div><br/></div> <div> <div style="color:Black;background-color:White"> <pre><span style="color:Blue">public</span> <span style="color:Blue">void</span> SetSharedState(IEnumerable&lt;Guid&gt; ids) { <span style="color:Green">// Simplified to bare minimum to repro the problem.</span> <span style="color:Blue">var</span> unshared = WhereNotShared(ids); <span style="color:Blue">foreach</span> (<span style="color:Blue">var</span> id <span style="color:Blue">in</span> unshared) { Console.WriteLine(id); } } </pre> </div> <div><br/></div> As you can see, it merely Calls into WhereNotShared and evalutes the result.</div> <div><br/></div> <div>Here's WhereNotShared. <strong>This is where the exception occurs</strong>. Commenting out this function fixes the bug.</div> <div> <div>            </div> <div style="color:Black;background-color:White"> <pre><span style="color:Blue">private</span> IEnumerable&lt;Guid&gt; WhereNotShared(IEnumerable&lt;Guid&gt; ids) { <span style="color:Blue">var</span> commandText = <span style="color:Blue">string</span>.Format(<span style="color:#A31515">&quot;SELECT Id FROM {0} WHERE ID = @IdParam;&quot;</span>, tableName); <span style="color:Blue">using</span> (<span style="color:Blue">var</span> readCommand = <span style="color:Blue">new</span> SqlCeCommand(commandText, connection)) { <span style="color:Blue">var</span> idParameter = <span style="color:Blue">new</span> SqlCeParameter() { ParameterName = <span style="color:#A31515">&quot;IdParam&quot;</span> }; readCommand.Parameters.Add(idParameter); <span style="color:Blue">foreach</span> (<span style="color:Blue">var</span> id <span style="color:Blue">in</span> ids) { idParameter.Value = id; <span style="color:Blue">if</span> (readCommand.ExecuteScalar() == <span style="color:Blue">null</span>) { yield <span style="color:Blue">return</span> id; } } } } </pre> </div> <div><br/></div> Commenting out the &quot;if (readCommand.ExecuteScalar() ...&quot; line above fixes the bug.</div> <div><br/></div> <div><strong>My question is, where is the bug here? </strong>Is this a Pex bug? Bug in SQL CE? Help!</div> <div><strong><br/></strong></div> <div><strong><br/></strong></div> <div><strong><br/></strong></div> <hr class=sig> Tech, life, family, faith: http://judahgabriel.blogspot.comThu, 12 Nov 2009 23:29:10 Z2009-11-13T22:27:23Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/5f89ee34-0e91-4e4e-938b-23a66ce5ecd0http://social.msdn.microsoft.com/Forums/en-US/pex/thread/5f89ee34-0e91-4e4e-938b-23a66ce5ecd0Madhuri Marrihttp://social.msdn.microsoft.com/Profile/en-US/?user=Madhuri%20MarriPex is not able to generate required input values to meet a condition, when using Factory method, whereas the required inputs are generated when the factory method code is moved to PUTHi,  <div><br/></div> <div>I have the following code under test, in which I have a branching condition that when met implies Pex goal is reached</div> <div><br/></div> <div> <div style="color:Black;background-color:White"> <pre><span style="color:Blue">public</span> <span style="color:Blue">void</span> TestMe(Utility util) { <span style="color:Blue">string</span> value = <span style="color:#A31515">&quot;&quot;</span>; <span style="color:Blue">if</span>(util.ContainsKey(<span style="color:#A31515">&quot;name&quot;</span>)) { Params.Add(<span style="color:#A31515">&quot;name&quot;</span>,util.GetParam(<span style="color:#A31515">&quot;name&quot;</span>) value = Param[<span style="color:#A31515">&quot;name&quot;</span>] } <span style="color:Blue">if</span> (value.Contains(<span style="color:#A31515">&quot;--&quot;</span>)) { PexGoal.Reached(<span style="color:#A31515">&quot;ReachMe&quot;</span>); <span style="color:Blue">return</span> <span style="color:Blue">null</span>; } } </pre> </div> <div><br/></div> I have a factory method for the &quot;Utility&quot; object as below</div> <div><br/></div> <div> <div style="color:Black;background-color:White"> <pre><span style="color:Blue">public</span> <span style="color:Blue">static</span> Utility Create([PexAssumeNotNull]<span style="color:Blue">string</span> sortString, [PexAssumeNotNull]<span style="color:Blue">string</span> name) { Dictionary&lt;<span style="color:Blue">string</span>, <span style="color:Blue">string</span>&gt; input_dictionary = <span style="color:Blue">new</span> Dictionary&lt;<span style="color:Blue">string</span>, <span style="color:Blue">string</span>&gt;(); input_dictionary.Add(<span style="color:#A31515">&quot;name&quot;</span>, name); Utility util = <span style="color:Blue">new</span> Utility(input_dictionary); <span style="color:Blue">return</span> util; } </pre> </div> </div> <div><br/></div> <div>On applying Pex on a PUT that invokes TestMe, Pex was not able to achieve the goal. However, when I moved the Factory method code to the PUT, Pex was able to achieve the goal. </div> <div><br/></div> <div>Just curious why...</div> <div><br/></div> <div>Thanks!</div> <div>Madhuri</div>Thu, 12 Nov 2009 04:05:46 Z2009-11-13T20:20:18Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/a47a62a2-86bc-4284-9191-cd2834ae58bbhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/a47a62a2-86bc-4284-9191-cd2834ae58bbxusheng.xiaohttp://social.msdn.microsoft.com/Profile/en-US/?user=xusheng.xiaoQuestion about reporting object creation issue<span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"> <div>Could you please tell me the current mechanism Pex use to report an object creation issue? In what situation it will consider failing to flip a path condition is because of an object creation issue?</div> </span>Thu, 12 Nov 2009 21:00:19 Z2009-11-13T20:00:39Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/85e45435-effe-4292-8137-d792c0ecbea9http://social.msdn.microsoft.com/Forums/en-US/pex/thread/85e45435-effe-4292-8137-d792c0ecbea9Judahhttp://social.msdn.microsoft.com/Profile/en-US/?user=JudahTearDown disposables with Pex?My class under test is an IDisposable object. <div><br/></div> <div style="color:Black;background-color:White"> <pre><span style="color:Blue">public</span> <span style="color:Blue">class</span> Foo : IDisposable { ... } <span style="color:Blue">public</span> <span style="color:Blue">static</span> <span style="color:Blue">partial class</span> FooFactory {     [PexFactoryMethod(<span style="color:Blue">typeof</span>(Foo))]     <span style="color:Blue">public</span> <span style="color:Blue">static</span> Foo Create()     {            ....     } } </pre> </div> <div><br/></div> <div>Foo also creates a file on hard disk. </div> <div><br/></div> <div>After each foo is created, I need to call .Dispose on it, then delete the file it created on hard disk.</div> <div><br/></div> <div>How can I instruct Pex to do this for every Foo it creates through the factory?</div> <hr class=sig> Tech, life, family, faith: http://judahgabriel.blogspot.comFri, 13 Nov 2009 18:41:24 Z2009-11-13T19:56:21Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/22723684-a715-4ff2-98c7-029874c87d56http://social.msdn.microsoft.com/Forums/en-US/pex/thread/22723684-a715-4ff2-98c7-029874c87d56Judahhttp://social.msdn.microsoft.com/Profile/en-US/?user=JudahDo I use NUnit Assert or PexAssert inside my PUTs?I'm using Pex with NUnit. In my PUTs, can I use NUnit.Assert? Or must I use PexAssert class?<hr class="sig">Tech, life, family, faith: http://judahgabriel.blogspot.comFri, 13 Nov 2009 15:38:14 Z2009-11-13T19:17:37Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/fe7973d3-1e91-4d7d-b1ef-22ef83d55006http://social.msdn.microsoft.com/Forums/en-US/pex/thread/fe7973d3-1e91-4d7d-b1ef-22ef83d55006Developer2006http://social.msdn.microsoft.com/Profile/en-US/?user=Developer2006Capitlize Method, Code Coverage different !!Hello PEX Team,<br /><br />I take the Capitalized method that you represent in your PEX video, and I run pex through it, now when I check the code coverage it tells me that code coverage is 83% !! where in your video code coverage was 100% !! <br />I took the same code, so why my code coverage is different than yours ?<br /><br />thanksSun, 11 Oct 2009 13:16:49 Z2009-11-13T18:04:55Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/01c70b97-bb85-4016-b4ee-bb1865e07dc6http://social.msdn.microsoft.com/Forums/en-US/pex/thread/01c70b97-bb85-4016-b4ee-bb1865e07dc6Pelihttp://social.msdn.microsoft.com/Profile/en-US/?user=PeliMake object creation through Reflection when an Invariant is found optionalThe module that decides to use Reflection to set the field of an object when  a class invariant is defined on the should be refactored as an attribute.<hr class="sig">Jonathan &quot;Peli&quot; de Halleux - <a href="http://social.msdn.microsoft.com/Forums/en/pex/thread/27c703ea-3928-41ef-b767-638c39966b99&#13;&#10;">Give us your input about Pex!</a>Fri, 13 Nov 2009 09:27:18 Z2009-11-13T09:27:18Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/a52fe770-e17a-42e9-a1ca-8c089831e8f1http://social.msdn.microsoft.com/Forums/en-US/pex/thread/a52fe770-e17a-42e9-a1ca-8c089831e8f1rgopalanhttp://social.msdn.microsoft.com/Profile/en-US/?user=rgopalanRegarding Number of blocks in Pex ReportHi,<br/> <br/> I have a method as follows:<br/> <br/> public override int Count<br/>  {<br/>     get { return references.Count; }<br/>  }<br/> <br/> I am running both VSTS and Pex on this method. While VSTS shows that this method has 3 blocks, Pex shows that this method has only 2 blocks. Can you please tell me why the number of blocks in Pex's report and VSTS coverage results do not match?<br/> <br/> Thanks!Thu, 12 Nov 2009 14:58:59 Z2009-11-13T07:46:03Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/5300f04a-4550-4861-9b08-9f9761369b9dhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/5300f04a-4550-4861-9b08-9f9761369b9dnanhuacrabhttp://social.msdn.microsoft.com/Profile/en-US/?user=nanhuacrabwhy not auto get interface subs?<pre lang="x-c#">public interface IOrderDAL { void GetOrderByID( Order order ); } public class OrderBLL { private IOrderDAL _dal; public OrderBLL( IOrderDAL dal ) { if ( null == dal ) { throw new ArgumentNullException( &quot;dal&quot; ); } _dal = dal; } } </pre> then test Constructor. pex generate the code: <div> <pre lang="x-c#">[PexMethod] public OrderBLL Constructor( IOrderDAL dal ) { // TODO: add assertions to method OrderBLLTest.Constructor(IOrderDAL) OrderBLL target = new OrderBLL( dal ); return target; }</pre> but the pex result only one test, the generate test code is:</div> <div> <pre lang="x-c#">[TestMethod] [PexGeneratedBy(typeof(OrderBLLTest), IsCustomInput = true)] [ExpectedException(typeof(ArgumentNullException))] public void Constructor02() { OrderBLL orderBLL; orderBLL = this.Constructor((IOrderDAL)null); }</pre> then i add code to PexAssemblyInfo.cs:</div> <div> <pre lang="x-c#">[assembly: PexExplorableFromConstructor( typeof( OrderBLL ), typeof( SIOrderDAL ) )]</pre> but no change, the result is not change? why?</div> <div>and how generate a not null IOrderDAL to OrderBLL Constructor? thanks!</div>Thu, 12 Nov 2009 07:25:15 Z2009-11-12T19:48:09Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/27c703ea-3928-41ef-b767-638c39966b99http://social.msdn.microsoft.com/Forums/en-US/pex/thread/27c703ea-3928-41ef-b767-638c39966b99Nikolai Tillmannhttp://social.msdn.microsoft.com/Profile/en-US/?user=Nikolai%20TillmannHow do you use Pex in Visual Studio? Your Input Is Needed!In continuation of our previous thread about licensing questions (<a href="http://social.msdn.microsoft.com/Forums/en-US/pex/thread/52763686-3eb6-47cf-950d-21b2baa07423">http://social.msdn.microsoft.com/Forums/en-US/pex/thread/52763686-3eb6-47cf-950d-21b2baa07423</a>), we would like to get some input from everyone how you are using Pex, and how you would like to use it.<br/><br/>Please copy&amp;paste and fill out the questions below.<br/><br/>1. Are you using Pex already? A) From Visual Studio, B) the command-line, C) other, D) no<br/>2. Which version of Visual Studio are you using? A) Professional, B) Team System, C) other<br/>3. How many people are in your team?<br/>4. Do you write A) Parameterized Unit Tests (PUTs), or B) only use the Wizard-generated PUT stubs?<br/><br/>Any other comments are appreciated as well, about the license terms, or required Visual Studio versions.<br/><br/>Thanks,<br/>Your Pex teamTue, 08 Sep 2009 23:05:04 Z2009-11-24T23:38:09Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/f4d7bdb6-34a2-4ac5-93ba-4c00fc5f47a1http://social.msdn.microsoft.com/Forums/en-US/pex/thread/f4d7bdb6-34a2-4ac5-93ba-4c00fc5f47a1rdefeohttp://social.msdn.microsoft.com/Profile/en-US/?user=rdefeoPex to test Entity FrameworkHi<br/><br/>I have a data access layer made of a library with entity framework in, and a seperate library to group together business operations.<br/><br/>I want to test the the business operation layer, how can i use PEX/STUBS/MOLES for this.  For example a very simple method i want to test is <span style="font-size:x-small"><span style="font-size:x-small"> </span></span> <p><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">public</span></span><span style="font-size:x-small"> </span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">Publisher</span></span><span style="font-size:x-small"> GetMM4Publisher() {<br/></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">  var</span></span><span style="font-size:x-small"> item = (</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">from</span></span><span style="font-size:x-small"> p </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">in</span></span><span style="font-size:x-small"> _context.Publishers<span style="font-size:x-small"> </span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">where</span></span><span style="font-size:x-small"> p.Id == 4<span style="font-size:x-small"> </span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">select</span></span><span style="font-size:x-small"> p).FirstOrDefault();<span style="font-size:x-small"> <br/></span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">  return</span></span><span style="font-size:x-small"> item; <br/>}</span></p> obviously i need to &quot;mock&quot; out the entity framework, its just that i am having difficultly understanding how to do this. I looked thought the examples included with PEX relating to EF but i could not see how it was relevant in this case. I assume I need to mole out <br/><br/><span style="font-size:x-small"><span style="font-size:x-small"> <p> </p> </span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">var</span></span><span style="font-size:x-small"> a = </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">new</span></span><span style="font-size:x-small"> Stubs.</span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">MEntities</span></span><span style="font-size:x-small">(); <br/><span style="font-size:x-small">a.PublishersGet = () =&gt; </span></span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">new</span></span><span style="font-size:x-small"> </span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">ObjectQuery</span></span><span style="font-size:x-small">&lt;</span><span style="font-size:x-small"><span style="font-size:x-small">Publishers</span></span><span style="font-size:x-small">&gt;(</span><span style="color:#a31515;font-size:x-small"><span style="color:#a31515;font-size:x-small">&quot;&quot;</span></span><span style="font-size:x-small">,</span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">null</span></span><span style="font-size:x-small">);<br/></span><br/>I just dont know how to mole this out correctly, any help would be greatly appreciated, PEX has been great i just want to use if for all my testing scenarios :)<br/><br/>Thanks!!!!!!!Tue, 10 Nov 2009 17:19:04 Z2009-11-12T19:32:41Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/39fe0a18-09be-4162-bfc9-fb32727ab06chttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/39fe0a18-09be-4162-bfc9-fb32727ab06cIan Ringrosehttp://social.msdn.microsoft.com/Profile/en-US/?user=Ian%20RingroseStubs needs a better name<p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-size:small;font-family:Times New Roman">Search for “</span><span style="font-size:9.5pt;color:#323223;font-family:Verdana">Stubs” on <a href="http://stackoverflow.com/search?q=stubs">stackoverflow</a> and it is very hard to find any questions/answers about the “Stubs” framework rather then about Stubs/mocks in general.</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-size:9.5pt;color:#323223;font-family:Verdana"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-size:9.5pt;color:#323223;font-family:Verdana">Likewise on google.</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-size:9.5pt;color:#323223;font-family:Verdana"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-size:9.5pt;color:#323223;font-family:Verdana">Therefore it is hard to anyone that is learning “Stubs”, so can we have a better name please…</span></p>Thu, 05 Nov 2009 10:23:23 Z2009-11-12T19:07:25Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/c5926f79-5b32-407a-a7df-4fc8d327e76fhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/c5926f79-5b32-407a-a7df-4fc8d327e76fAlexander Wurzingerhttp://social.msdn.microsoft.com/Profile/en-US/?user=Alexander%20WurzingerTestCleanUp executed after MaxWorkingSet boundary reached ?Hi,<br/> I was wondering if the TestCleanUp is Executed if the MaxWorkingSet boundary is reached.<br/> Since in one of my Test, I allocate a lot of data, and if the TestCleanUp isn't executed, then there is no way, that any of the next tests may be executed.<br/> Anyway, in my (Pex)Testclass, the big Test gets executed, but the next one says 'exploration boundary max working set was reached with 2826 MB' (the boundary is set to 1500 on the class), so I was wondering if the TestCleanUp, which is supposed to cleanup is even executed, of if there is any chance that it wasn't/maybe was even stopped ...<br/> Anyway, since I increased the boundary I will probably know with the next run.<br/>Tue, 10 Nov 2009 21:39:59 Z2009-11-12T13:17:28Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/ad34d5b5-415b-416b-b96c-6ed0203e4098http://social.msdn.microsoft.com/Forums/en-US/pex/thread/ad34d5b5-415b-416b-b96c-6ed0203e4098Dyd666http://social.msdn.microsoft.com/Profile/en-US/?user=Dyd666Can't create properly Test projectHi,<br/> <br/> This is my first project with Tests, and already I am having a problem. But I don't believe that it is big issue, but somehow I can't resolve it.<br/> <br/> Anyway, I would like to use Pex and I started with GettingStarted video and created Capitalize method. The problem occurs when I create tests using &quot;Save All&quot; option in the Pex exploration results window. Test project is created and Pex methods also, but somehow they are not decorated with TestMethod and TestClass attributes. And also a reference to UnitTest framework is not added in the project automatically. I presume that this is not a big issue and that it only needs to be set somewherem but I just can't find the solution.<br/> <br/> All my method look exactly like in the video tutorial. Except for this issue.<br/> <br/> Here is my StringTest class:<br/> <br/> <pre lang="x-c#">namespace PexDemo { [PexClass(typeof(Strings))] [PexAllowedExceptionFromTypeUnderTest(typeof(ArgumentException), AcceptExceptionSubtypes = true)] [PexAllowedExceptionFromTypeUnderTest(typeof(InvalidOperationException))] public partial class StringsTest { [PexMethod] public string Capitalize(string value) { // TODO: add assertions to method StringsTest.Capitalize(String) string result = Strings.Capitalize(value); return result; } } }</pre> <br/> And a part of ...g.cs class:<br/> <br/> <pre lang="x-c#">using System; using Microsoft.Pex.Framework.Generated; using Microsoft.Pex.Framework; namespace PexDemo { public partial class StringsTest { [PexGeneratedBy(typeof(StringsTest))] [PexRaisedException(typeof(NullReferenceException))] public void Capitalize01() { string s; s = this.Capitalize((string)null); } [PexGeneratedBy(typeof(StringsTest))] public void Capitalize02() { string s; s = this.Capitalize(&quot;&quot;); PexAssert.AreEqual&lt;string&gt;(&quot;&quot;, s); } [PexGeneratedBy(typeof(StringsTest))] public void Capitalize03() { string s; s = this.Capitalize(&quot;\0&quot;); PexAssert.AreEqual&lt;string&gt;(&quot;&quot;, s); } ... ... ... }</pre> As you can see there are no TestMethod attributes.<br/> <br/> Cheers :)Wed, 11 Nov 2009 15:09:20 Z2009-11-12T09:09:58Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/754fc913-cc8f-494a-8cc4-07b79bfb1f19http://social.msdn.microsoft.com/Forums/en-US/pex/thread/754fc913-cc8f-494a-8cc4-07b79bfb1f19Yauhen Safrankouhttp://social.msdn.microsoft.com/Profile/en-US/?user=Yauhen%20SafrankouPex Exploration throws ClrMonitorFail (-667)<p>I encounter an odd failure while running Pex Exploration. It reports the following error:<br/><br/><em>Exit Code ClrMonitorFail  <br/>Exit Code ClrMonitor<br/>Exit code returned when the ExtendedReflection profiler encountered a fatal error. <br/>Value: -667</em><br/><br/>I see the issue in the following environment:<br/>- Pex 0.18.41014.0 DevLabs Pre-Release for commercial evaluation;<br/>- VS 2008 SP1 Team System;<br/>- Windows Vista Enterprise.<br/><br/>The code is pretty basic.<br/><br/>Assembly ClassLibrary contains one empty class:<br/><br/><span style="font-size:x-small"><span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> </span><span style="font-size:x-small"><span style="color:#2b91af">ClassLib<br/></span>{<br/>}<br/><br/>Another assembly CodeToTest contains the class:<br/><span style="font-size:x-small;color:#0000ff"><br/>public</span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#0000ff">class</span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#2b91af">ClassUnderTest </span><span style="font-size:x-small">{<br/></span><span style="font-size:x-small;color:#0000ff">    private</span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#0000ff">static</span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#0000ff">readonly</span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#2b91af">ClassLib</span><span style="font-size:x-small"> staticObject = </span><span style="font-size:x-small;color:#0000ff">new</span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#2b91af">ClassLib</span><span style="font-size:x-small">();<br/></span><span style="font-size:x-small;color:#0000ff"><br/>    public</span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#0000ff">int</span><span style="font-size:x-small"> Sum(</span><span style="font-size:x-small;color:#0000ff">int</span><span style="font-size:x-small"> x, </span><span style="font-size:x-small;color:#0000ff">int</span><span style="font-size:x-small"> y) { </span><span style="font-size:x-small;color:#0000ff">return</span><span style="font-size:x-small"> x + y; }<br/>}<br/><br/>And the test assembly TestProject contains one test fixture:<br/><span style="font-size:x-small"><br/>[</span><span style="font-size:x-small;color:#2b91af">TestClass</span><span style="font-size:x-small">, </span><span style="font-size:x-small;color:#2b91af">PexClass</span><span style="font-size:x-small">(</span><span style="font-size:x-small;color:#0000ff">typeof</span><span style="font-size:x-small">(</span><span style="font-size:x-small;color:#2b91af">ClassUnderTest</span><span style="font-size:x-small">))]<br/></span><span style="font-size:x-small;color:#0000ff">public</span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#0000ff">partial</span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#0000ff">class</span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#2b91af">ClassTest </span><span style="font-size:x-small">{<br/>    [</span><span style="font-size:x-small;color:#2b91af">PexMethod</span><span style="font-size:x-small">]<br/></span><span style="font-size:x-small;color:#0000ff">    public</span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#0000ff">void</span><span style="font-size:x-small"> Test(</span><span style="font-size:x-small;color:#0000ff">int</span><span style="font-size:x-small"> x, </span><span style="font-size:x-small;color:#0000ff">int</span><span style="font-size:x-small"> y) {<br/></span><span style="font-size:x-small;color:#0000ff">        var</span><span style="font-size:x-small"> t = </span><span style="font-size:x-small;color:#0000ff">new</span><span style="font-size:x-small"> </span><span style="font-size:x-small;color:#2b91af">ClassUnderTest</span><span style="font-size:x-small">();<br/></span><span style="font-size:x-small;color:#2b91af">        Assert</span><span style="font-size:x-small">.AreEqual(x + y, t.Sum(x, y));<br/>    }<br/>}<br/><br/>When I run the Pex Exploration against the TestClass.Test method, I see the error mentioned above.<br/><br/>I also tried to run the exploration from the command line — the same result.<br/><br/><em>c:\test\PexTest\TestProject\bin\Debug&gt;pex TestProject.dll<br/>Microsoft Pex v0.18.41014.0 -- </em><a href="http://research.microsoft.com/pex"><em>http://research.microsoft.com/pex</em></a><br/><em>Copyright (c) Microsoft Corporation 2007-2009. All rights reserved.</em></span></span></span></p> <p><span style="font-size:x-small"><span style="font-size:x-small"><span style="font-size:x-small"><em>instrumenting... launched Pex 0.18.41014.0 x86 Edition on .NET v2.0.50727<br/>process id: 6628<br/>current directory: c:\test\PexTest\TestProject\bin\Debug<br/>[reports] recycling reports in background<br/>00:00:00.0&gt; starting execution<br/>  00:00:00.0&gt; reflecting tests<br/>  00:00:00.4&gt; TestProject<br/>    00:00:00.4&gt; ClassTest<br/>      00:00:00.5&gt; Test(Int32, Int32)<br/>        LAUNCHER FAILED<br/>error description: ClrMonitorFail (-667)</em><br/><br/>How can I get more information about the nature of the error?<br/><br/>I assume the failure may occur, because I have the system with quite restricted environment. Though, I tried to run VS with Administrator's privileges.</span></span></span></p> <p><span style="font-size:x-small"><span style="font-size:x-small"><span style="font-size:x-small">The issue dissapears, if I comment the static member:<br/><span style="font-size:xx-small"><span style="color:#0000ff"><span style="font-size:x-small;color:#008000"><br/>//private static readonly ClassLib log = new ClassLib();<br/><span style="font-size:x-small"><span style="font-size:x-small"><span style="font-size:x-small"><span style="color:#000000"><br/>Any thoughts why it happens?<br/><br/>Thanks!</span></span></span></span></span></span></span></span></span></span></p>Wed, 11 Nov 2009 15:44:47 Z2009-11-11T21:01:11Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/9eaff265-f39b-4082-8a70-4b98d7f050d6http://social.msdn.microsoft.com/Forums/en-US/pex/thread/9eaff265-f39b-4082-8a70-4b98d7f050d6Alexander Wurzingerhttp://social.msdn.microsoft.com/Profile/en-US/?user=Alexander%20WurzingerUninstrumented Methods warning for Types/Assembly witch are instrumentedHi,<br/>I noticed that there are some Types/Assemblies witch are listed a Uninstrumented, even if I add the PexInstrumentType/PexInstrumentAssembly flag for them.<br/>For Excample<br/>Type: Object, IntPrt, Type, GC, Array, StringBuilder, EventArgs, Exception<br/>Assmebly: System, Microsoft.ExtendedReflection<br/><br/>Is there any reason for this ?<br/>If yes, then why are they even listed as Uninstrumented, and we are givven the option to instrument them ?Wed, 11 Nov 2009 00:15:09 Z2009-11-11T01:20:26Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/c03e5bc8-1ba0-4419-a108-d72b7aa26c6chttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/c03e5bc8-1ba0-4419-a108-d72b7aa26c6cGeoffreyKhttp://social.msdn.microsoft.com/Profile/en-US/?user=GeoffreyKPexBooleanAsZeroOrOne not honored when placed on testI had some issues with PexAssertFailedExceptions, and found a posting about using the PexBooleanAsZeroOrOne to get ride of the exception, but when I add this to my test case that was generated using Pex I still get the issue when I run the test using MSTest.  I'm using the latest Pex bits, and VS2008 Team Suite.  My test method looks like this:<br/><span style="font-size:x-small"><font size=2> <p>[</p> </font></span> <p><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">PexMethod</span></span><span style="font-size:x-small">]<font size=2> <p>[</p> </font></span></p> <p><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">PexBooleanAsZeroOrOne</span></span><span style="font-size:x-small">]<font size=2> <p> </p> </font></span></p> <p><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">public</span></span><span style="font-size:x-small"> </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">void</span></span><span style="font-size:x-small"> AddRegisterTagstoConfigGetSet([</span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">PexAssumeUnderTest</span></span><span style="font-size:x-small">]</span><span style="color:#2b91af;font-size:x-small"><span style="color:#2b91af;font-size:x-small">CommandLineArguments</span></span><span style="font-size:x-small"> target, </span><span style="color:#0000ff;font-size:x-small"><span style="color:#0000ff;font-size:x-small">bool</span></span><span style="font-size:x-small"> value) <p>{</p> </span></p><hr class="sig">Thanks, --GeoffTue, 10 Nov 2009 15:35:47 Z2009-11-12T08:11:26Zhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/55c4d854-df8f-453c-bb2d-52ea1561b05bhttp://social.msdn.microsoft.com/Forums/en-US/pex/thread/55c4d854-df8f-453c-bb2d-52ea1561b05brdefeohttp://social.msdn.microsoft.com/Profile/en-US/?user=rdefeoPEX explorations fails<span style="font-size:xx-small"> <p>I follow thorught the Capatalise tutorial, e.g. <br/>create the class library, <br/>added the code and compiled it,<br/>Created paramaterised test stubs,<br/>however Run Pex Explorartions results in am error &quot;createion of fixutre of type AssemblyName.StringExtenrionsTest Fail&quot;<br/>--- Description<br/>creation of fixture of type AnotherTry.StringExtensionsTest failed<br/> <br/>creation of fixture of type AnotherTry.StringExtensionsTest failed<br/> <br/>--- Exception details<br/> <br/>System.Security.VerificationException: Operation could destabilize the runtime.      at System.Void AnotherTry.StringExtensionsTest..ctor() <br/> <br/> <br/>The Output window is as follows!!<br/><br/>launching pex</p> <p>starting...</p> <p>\\data\users\rdefeo\Visual Studio 2008\Projects\AnotherTry\AnotherTry.Tests\bin\Debug\AnotherTry.Tests.dll</p> <p>&quot;C:\Program Files\Microsoft Pex\bin\Microsoft.Pex.exe&quot; &quot;\\data\users\rdefeo\Visual Studio 2008\Projects\AnotherTry\AnotherTry.Tests\bin\Debug\AnotherTry.Tests.dll&quot; /membernamefilter:M:Capitalize! /methodnamefilter:Capitalize! /namespacefilter:AnotherTry! /typefilter:StringExtensionsTest! /x64failsilently /targetclrversion:v2.0.50727 /targetclrversion2 /donotopenreport /reportlevel:None /reportrootpath:&quot;\\data\users\rdefeo\Visual Studio 2008\Projects\AnotherTry\AnotherTry.Tests\bin\Debug\reports&quot; /testframework:NUnit /testlanguage:cs /testprojectfile:&quot;\\data\users\rdefeo\Visual Studio 2008\Projects\AnotherTry\AnotherTry.Tests\AnotherTry.Tests.csproj&quot; /testprojectnotupdate /testprojectskip</p> <p>using waiting pex process</p> <p>waiting for monitored process</p> <p>listening to monitored process (warm start)</p> <p>00:00:00.0&gt; starting execution</p> <p>00:00:00.0&gt; reflecting tests</p> <p>00:00:00.3&gt; AnotherTry.Tests</p> <p>00:00:00.3&gt; StringExtensionsTest</p> <p>00:00:00.3&gt; Capitalize(String)</p> <p>!error! [execution] creation of fixture of type AnotherTry.StringExtensionsTest failed</p> <p>!warning! [execution] could not generate any test in 0 runs</p> <p>00:00:00.4&gt; [finished] execution time 00:00:00.3906150.</p> <p>-- 0 critical errors, 1 errors, 1 warnings.</p> <p>-- 0 generated tests, 0 failing, 0 new, 0 inconclusive.</p> <p>[coverage] skipping coverage reports...</p> <p>[reports] skipping html reports</p> <p>EXPLORATION FAILED</p> <p> </p> <p>monitored process exited with DefaultFailure (-1000)</p> <p>finished<br/><br/><br/>I have already installed and removed and re-installed<br/>Do you have any idea what the problem is?????? </p> </span>Fri, 06 Nov 2009 14:45:09 Z2009-11-08T22:44:06Z