This project has moved. For the latest updates, please go here.

Report Generator Skipping Generics

Mar 28, 2014 at 5:25 PM
I have a bunch of generic classes and methods, and the report generator is skipping these. When I pulled down the source, i found the query is filtering all generics out.. When I remove the where clause from the query, all my generics show up. I am using the visualstudioparser.

.Where(c => !c.Value.Contains("__") && !c.Value.Contains("<") && !c.Value.Contains("."))

Is this intentional?
Coordinator
Mar 28, 2014 at 9:02 PM
Thanks for reporting this issue!

The code is intentional to exclude compiler generated classes. But maybe the condition filters to many classes.
I will check what I can do about it and come back to you within the next days.
Mar 28, 2014 at 10:10 PM
Thanks, the compiler generated code shows up when you load the .coverage file in visual studio and count towards total coverage. The list of methods match between the report and the .coverage file when the where clause is removed.

I also noticed when I load my .coverage file into visual studio the lines covered and not covered and the percentage are not the same as the report generated. They are a bit off in the report.

Thanks
Coordinator
Apr 1, 2014 at 2:30 PM
Could you please post a minimum code sample which helps me tor reproduce the issue.

I just tried with the following class:
    class GenericClass<T>
    {
        public void Process(T input)
        {
            Console.WriteLine(input.ToString());
        }
    }
This has the name GenericClass`1 in the coverage file and shows up correctly in the report.
What's different in your code base?


Regarding different coverage results:
The Visual Studio coverage is a little bit different. It distinguishes between Covered, Partial Covered and Not Covered.
That may cause (slightly) different results.
Apr 2, 2014 at 1:56 PM
Here is an example of a class that doesn't show up in the report.
public abstract class SomeClass<TModel, TState> : ISomeClassInterface<TModel, TState> 
where TModel : SomeModel
where TState : IState

public abstract bool Process(ISomeObjectInterface<TModel, TState> someObject);

public virtual bool PostProcess(ISomeObjectInterface<TModel, TState> someObject)
{
     return true;
}
If you then create a class that inherits from this abstract class and then cover the methods, the assembly shows up in the report, but the class doesn't.

I would also like to see the compiler generated methods in the report since I see them when I load the .coverage file into VS. Can there be a switch for this?

Thanks
Coordinator
Apr 2, 2014 at 2:45 PM
I'm sorry but I can't reproduce the issue. When I add a class deriving from SomeClass both classes (SomeClass and DerivedClass) show up in the report.

Could you provide a sample project which I can use to reproduce the issue?

To you have a sample for "compiler generated methods" as well? Perhaps a sample class or a screenshot may help me to understand what you mean.

Thanks in advance
Coordinator
Apr 10, 2014 at 9:07 PM
I really would like to fix this in the next release.
Could you please provide a full sample project which I can use to reproduce the issue (one class that triggers the error would be enough)?

Would be great if you could help.
Coordinator
Apr 15, 2014 at 7:15 PM
Edited Apr 24, 2014 at 9:25 PM
Thanks for your help. I was able to reproduce the issue. It's fixed and it would be great if you could test the new beta release:
https://www.nuget.org/packages/ReportGenerator/2.0.0-beta4

Fixed in changeset #74910