John said:
I would expect it to only call any API's when its handling calls
within the Microsoft namespace, as this touches more on microsoft
operating system functionality - whereby the remaining namespaces are
cross platform and would be very unlikely to drop into API's.
I don't think you've thought this through John.
For example, the classes in System.EnterpriseServices are almost all
direct wrappers around the COM+ APIs. Then there are classes in
System.Net.Sockets where many classes are wrappers around Winsock 2.0,
and then there's classes in System.Threading that are wrappers around
Win32 threads and synchronization objects, do I need to go on?
Yes there are classes that are pure IL and don't make any calls to Win32
or Windows COM objects, but many classes do. I have done an analysis of
various versions of .NET by checking metadata to see which methods are
COM, pinvoke, or embedded native code, and which are internalcall. I
have also 'walked' through all IL in every IL method to see the method
calls it makes and then analyse the type of method called. The results
are shown here:
http://www.grimes.demon.co.uk/dotnet/dotnetWrappers.htm
For .NET v2.0 I find that there are
Methods in the framework:
IL Methods 92.8%
COM methods 4.2%
pinvokeimpl methods 2.5%
internalcall methods 0.40%
native methods 0.04%
Thus the implementation of almost 7% of methods is not in IL.
Method calls within the assembly:
IL Methods 56.3%
COM methods 0.18%
pinvokeimpl methods 0.98%
internalcall methods 0.80%
native methods 0.02%
Method calls outside the assembly:
IL Methods 38.3%
COM methods 0.03%
pinvokeimpl methods 0.01%
internalcall methods 2.3%
native methods 0%
This is better, just over 1% of calls is to non-IL methods.
Of course, my analysis does not take in to account how often methods are
called. AFAIK the method calls implemented through pinvoke may be the
most called methods <g>
Richard