In a previous post, I detailed how the .NET 4.5 assemblies of the BCL are packaged in Desktop and Windows 8 managed Apps. When you starts coding your first Win8 Apps, you quickly end up scratching your head about the types you use to know but which are no longer available.
A good help is the auto-completion feature of the code editor or the Object Browser in Visual Studio. In the later case, you select “.NET for Metro style apps” in the Browse combo-box:
The Object Browser lists the assemblies and then the namespaces of the types defined within. You notice that mscorlib does not expose any type (look at the black triangle when you try to open a namespace) because they are defined by other assemblies as explained in my previous post.
But how to get the list of the types available in the BCL for the Desktop Apps but missing from the WinRT projection?
Well… by doing exactly what the previous sentence tells:
- list the assemblies in the folder of the WinRT version of the .NET framework and get all public non nested types
- list the same assemblies but from the Desktop version of the .NET framework and get all public non nested types
- list all types from 2. and if not present in 1., then this type is missing
This is what BCLDiff is doing by also grouping all the missing types by namespace.
I’m calling the unmanaged Reflection API
IMetaDataDispenser to load each assembly. The types are listed via
EnumTypeDefs from the
IMetaDataImport interface. The
GetTypeDefProps method is used to get the name of the type and its parent token. If this parent is not defined in the same assembly, instead I need to call
GetTypeRefProps to get its name and figure out if it is a delegate, an enum or a value type. The corresponding icon is then displayed thanks to a simple
I hope this helps