In this post, I use the
NDepend assembly
comparison feature
to assess the public API compatibility between Mono 2.0
and the .NET Framework 3.5 SP1.
The assemblies considered
are: mscorlib, System, System.Core, System.Messaging, System.Runtime.Remoting, System.Runtime.Serialization.Formatters.Soap, System.Security, System.ServiceProcess, System.Transactions, System.Web, System.Web.Services, System.Windows.Forms, System.Xml, System.Xml.Linq, System.Configuration, System.Configuration.Install, System.Data.DataSetExtensions, System.Data, System.Data.Linq, System.Data.OracleClient, System.Design, System.DirectoryServices, System.Drawing.Design, System.Drawing, System.EnterpriseServices, System.Management
We consider .NET
Framework bits as the newer build and the Mono ones as the older build. Thus
the following CQL Query
lists public types of the .NET Framework not supported by Mono:
SELECT TYPES WHERE IsPublic AND WasAdded
The result is 1553 public
types not supported, to compare to 5720 public types supported. On
the following metric view, you can see these types in blue. Each
rectangle represents an assembly, namespace, type or method and the
size of the rectangle is proportional to the underlying number of IL
instructions.
With the following CQL
query it is easy to pinpoint that amongst not supported types, 499 are wrapper
of native win32 methods. We rely on the fact that such wrapper types are nested in outer types
named NativeMethods.
SELECT TYPES WHERE IsPublic AND WasAdded AND !NameLike "NativeMethods+"
The list of the 1054
types not supported and not win32 wrappers is available here.
This list includes:
- a few Windows.Forms public implementation
details,
- the namespace System.Deployment.Internal.Isolation.Store,
- the namespace System.Web.UI.WebControls.WebParts,
- some ASP.NET/System.Web details like in Configuration, Security, Hosting, Caching,
Management,
- some System.Security.Policy and Permissions
types,
- the namespace System.Security.AccessControl,
- some CLR related public types
like InsufficientMemoryException,
MTAThreadAttribute, GCNotificationStatus
- some System.Runtime.Remoting and Serialization
types and the namespace System.Runtime.Remoting.Metadata.W3cXsd2001
- obviously, many of the System.Runtime.InteropServices‘s types
- a few types from System.Runtime.CompilerServices, System.Reflection, System.Globalization, System.IO
and System.Threading
- most of System.Diagnostics.SymbolStore’s
types
- System.Web.UI.Design.WebControls‘s
designer and editor (they muight be in a non-referenced assemblies ?)
- some System.Data, System.Data.SqlTypes and Microsoft.SqlServer’s types
- a few System.Xml.Serialization.Configuration’s
types
- several namespaces of the
assembly System.Core.dll, including System.Diagnostics.*,
System.IO.*, System.Security.*, System.Threading.*, System.Management.Instrumentation.*
- most of System.DirectoryServices.dll’s types
- a few System.Transactions and System.Messaging’s types
On the other hand Mono
introduces 77 new public types all listed here. This list was obtained with the CQL query:
SELECT TYPES WHERE IsPublic AND WasRemoved
Most of them look
like implementation details that might be turned to internal, or that might be
useful for some advanced pure-Mono scenarios.
Concerning dependencies between
assemblies, the following matrix shows a few changes.
- Cells with a red tick
with a + means dependency in the .NET Fx absent in Mono,
- Cells with a red tick
with a - means dependency in Mono absent in the .NET Fx,
- Cells with a red tick means
coupling between 2 assemblies changed between Mono and the .NET Fx,
Finally I noticed that
Mono is much more lightweight in terms of IL instructions: 1 629 065 for Mono
and 3 591 830 for the .NET Fx. I have no explanation for this. The missing types
cannot explain such a difference (as we can see on the metric view above,
displayed with the #IL instructions metric). Maybe it is due to some Mono C#
compiler special behavior and optimization?
Posted
Mon, Jan 19 2009 5:41 AM
by
Patrick Smacchia