Phantom WPF Code (can't be completely excluded)

Phantom WPF Code (can't be completely excluded)

When working with the WPF framework, Visual Studio generates a bunch of connector code to connect the .xaml files to the class file underneath it. The generated code has some horrendous cyclomatic complexity associated with it, but because it is not something we wrote, we don't want to see the report on that cyclomatic complexity.

Here's the delimna: By default, IComponentConnector.Connect is included with the coverage results--only that is the name of the method that the compiler creates to bind XAML files to the .Net source code (C# in our case). I want to cover the code in the C# file we created, but I don't want to cover the code generated by Visual Studio. When I exclude the .xaml file from being covered, the offending method is excluded from the list of methods in our window. The problem is that the cyclomatic complexity is still reported at the class level even though there is no method in the backing C# class that matches that value. When you see a peak cyclomatic complexity of 88, and then you search for the offending code it isn't there. Even when I include the xaml files, the method is reported but there is no source code.

Please exclude values from the class level reporting that is excluded from the rest of the class. I really don't care about debugging Microsoft's work--they don't appreciate it anyway.


RE: Phantom WPF Code (can't be completely excluded)

bloritsch,

Yes, that generated code can get complex! Reminds me of balled-up fishing line. I am going to set this up and run it on my system to see if I can produce the same results. I'll be back in touch soon. Thanks for the post.


RE: Phantom WPF Code (can't be completely excluded)

Followup: I've worked with the NCover team to reproduce the issue, and have just confirmed the fix for this issue. It'll probably be in the next patch release.