Missing BCL types in WinRT

Download BCLDiff (x86 | x64)

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:

  1. list the assemblies in the folder of the WinRT version of the .NET framework and get all public non nested types
  2. list the same assemblies but from the Desktop version of the .NET framework and get all public non nested types
  3. 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 TypeConverter.

I hope this helps

This entry was posted in .NET, C#, Metro, WinRT and tagged , , , , . Bookmark the permalink.

3 Responses to Missing BCL types in WinRT

  1. Pingback: Inter-Process Communication with file association in WinRT – Part 2 | Anything about WinRT

  2. Pingback: Listing Windows 8.1 Preview additions to WinRT | Anything about WinRT

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s