GEnerated cs file has errors

May 28, 2008 at 3:44 PM
When I run Pex it creates .cs files and put stubs in them. Several time I have encountered errors in the cs file. Like this one says that square bracket should be closed:

  [TestMethod]
        [PexRaisedException(typeof(NullReferenceException))]
        [PexGeneratedBy(typeof(TestCustomer))]
        public void should_be_able_to_extract_the_id_from_the_query_string_urlString_20080528_104150_000()
        {
            this.should_be_able_to_extract_the_id_from_the_query_string_url((string)null);
        }

Although from the above code it looks decent.


Coordinator
May 28, 2008 at 7:47 PM

I think there is a copy/paste problem, in that sometimes code pasted into a VS text editor somehow gets mangled with "invisible" damage. If you reformat the file after revceiving these invisible errors things seem to work. My theory is that this might be an interaction between VS and some add-ins, where both are analyzing and possibly reformatting code as it is entered.

I see this with ReSharper, and I simply run "code Cleanup" on the file and the spurious error vanishes.