Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does version 255.255.255.255 for winmd files indicate?

I noticed that most (all?) .winmd files have a version of 255.255.255.255 like:

Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null

Metro apps have a reference to such assemblies with this version number.


Further the Windows.winmd itself references:

mscorlib, Version=255.255.255.255, Culture=neutral, PublicKeyToken=b77a5c561934e089

However, an assembly with this version number does not exist, as far as I know.

Does this version number have a special meaning? Is there any documentation for this?

like image 726
logicnp Avatar asked May 02 '12 09:05

logicnp


2 Answers

ECMA 335 assemblies need to have a version number. But the windows runtime type resolution algorithm doesn't use the version number, so the team creating the winmd format chose an arbitrary version number of 255.255.255.255 for the assembly version number.

That helps to ensure that nobody attempts to use the .Net type resolution algorithm when doing type resolution (it's not perfect, unfortunately some tools still use the .Net type resolution algorithm).

Oh and the mscorlib reference is a pro-forma reference - ECMA 335 requires that all typeref's have a corresponding assemblyref and the WINMD file format chose to use typerefs to certain ECMA 335 types as indicators of a specific type. For example, the winrt "enum" construct is represented as a type which extends "System.Enum" - for a winmd file the "System.Enum" part is just a string (it could have been anything), and cannot be resolved to a real type. That string is represented in metadata as a typeref and typerefs have to have an assemblyref - we chose to use the mscorlib version of System.Enum as the assemblyref for the enum because it was convenient.

like image 163
ReinstateMonica Larry Osterman Avatar answered Nov 09 '22 11:11

ReinstateMonica Larry Osterman


Keep in mind that the .winmd files contain metadata for the WinRT interfaces. Windows can't assume that any particular version of .NET will be used. Windows 8 will be around a lot longer than .NET 4.5

Nor can a .NET project assume it will run on any particular version of Windows. It should work just as well on Windows 8 as on Windows 10.

So interpret 255.255.255.255 as "any version".

like image 29
Hans Passant Avatar answered Nov 09 '22 13:11

Hans Passant