This project is read-only.

Many warnings when using the .NET 4.0 Framework


When targeting the .NET 4.0 framework, the CopyFromIndexComponent gives a lot of warnings.
In .NET 4.0 the same type is implemented in multiple assemblies and namespaces are spread over multiple assemblies. The result is that the CopyFromIndexComponent gives a lot of duplicate warnings. You can turn these warnings off in the configuration, but it would be nice to filter out the spurious warnings and only give relevant warnings.
Note - I regenerated the reflection data using .NET 4.0.

file attachments


EWoodruff wrote Mar 6, 2012 at 4:04 PM

The problem is figuring out if a warning is spurious or relevant. I suppose you could filter out anything from the base framework classes (System. and Microsoft.) and only show the warning if it's not in one of those namespaces.

DonFehr wrote Mar 8, 2012 at 9:54 AM

That's a good idea. Question - the CopyFromIndexComponent seems to choose one of the assemblies as the "real" one and ignores duplicates. How would that affect the results?

It might be relevant to add a filter by target environment (i.e. WPF, Silverlight etc.) because that's the source of most of the duplication. I haven't looked at this in any detailed way.

EWoodruff wrote Mar 8, 2012 at 4:27 PM

As I recall, the way works now is the last one seen wins. As such, it depends on the order in which the elements are defined in the configuration and in which file it finds the last duplicate entry. It probably should use a separate set of reflection data and comments files for each framework. It's something I plan on looking into later.

wrote Mar 10, 2012 at 12:27 AM

EWoodruff wrote Mar 10, 2012 at 12:27 AM

I took a look at this. The warnings you are referring to are actually not suppressable. The ones that are are defaulted to Ignore so we're not seeing them anyway. I think you're only seeing them now from the reflection files because you rebuilt them. If you used the project file from the Sandcastle Examples folder (as the script included with SHFB does), I don't feel that it does it correctly and that actually causes the issue.

As it is given, it processes each assembly separately so it will miss some details about classes that are implemented by others across assemblies. What it should do is process all assemblies in one pass and use the SegregateByAssemblies.exe tool to split the resulting reflection.xml file into separate files by namespace. Doing it this way, you end up with a set of files just like the ones distributed with the Sandcastle release that don't generate all the warnings.

You will see the warnings from the XML comments files though and for that, it would be worth adding an option to suppress them so I will. I've also already added a verbosity option to BuildAssembler so that you can suppress all the unwanted info which helps a lot too.

I've attached new BuildReflectionData.bat and BuildReflectionData.proj files here that can be used to rebuild the reflection data as described above. I'll be including them in the Sandcastle update as well in case anyone needs them.

wrote Mar 10, 2012 at 12:28 AM

EWoodruff wrote Mar 10, 2012 at 12:28 AM

Attached project file

EWoodruff wrote Mar 10, 2012 at 12:31 AM

Correction: That should be SegregateByNamespace.exe

wrote Feb 22, 2013 at 1:39 AM