where/how can I find whether a .net class uses IOCP?
.net, asynchronous, c#, iocp
Solution
I/O completion ports are a strong platform implementation detail, one that .NET cannot blindly depend on to be available. And it doesn't, it leaves it up to the CLR host to implement the glue to the operating system support for it. The underlying hosting interface is IHostIoCompletionManager, available since .NET 2.0
So if you want a hard guarantee the they actually get used then you need to get the source of the CLR host that you use. This is hard to come by, there are many and you'd need to apply to a job at Microsoft to get access to the source. Only the SSCLI20 host is available in source, it is dated and covers only the default host. Which was itself tweaked to allow the PAL to provide the I/O completion port, surely not actually present in the real CLR hosts you'd ever run on.
You were not specific about what platforms you consider. Some guesstimates:
- ASP.NET: yes, I/O completion ports are a big deal for sockets
- SQL Server: pretty likely, but no slamdunk, it has a knack for doing things differently
- Desktop: yes, for any .NET version >= 2.0 that runs on the NT branch
- Compact: definitely not
- Micro: definitely not
- XBox: unlikely, OS details are a big mystery
- Silverlight: Windows version's CoreCLR.dll uses it but no ThreadPool.BindHandle
- Phone7: similar to Silverlight
- Phone8: big mystery, probably.
Emphasizing that these are merely educated guesses that are not backed by proof. The question is otherwise fairly strange, it is not like you'd have an alternative if you find out that async I/O was done by overlapped I/O.
Problem
Update I asked the wrong question, rephrased (based on the great info on answers and comments): Is there any good source on .net's async operations being real async, thus either IOCP or async(overlapped)? Is there any quick way to find out if several classes are doing so? Example of not trusting framework developers blindly The natural starting point for creating a FileStream is the static File.Open() method, the documentation for which mentions nothing about synchronicity of the FileStream that is created! Nor does it allow you to provide FileOptions (which are used to specify the magic FileOptions.Asynchronous flag). Instead, the FileStream is created with FileOptions.None. Any asynchronous operations are quietly faked by the obliging implementation of the Stream base class, which merely wraps the corresponding synchronous method in a delegate and invokes it on the thread pool using the BeginInvoke() method. This is a deviation from the usual ‘pit of success’ design philosophy, where everything in .NET seems to work as you think it would, without a need to closely read the documentation and/or gradually discover obscure catches and gotchas over time. I've been trying to find information on the use of IO Completion Ports in `.NET`. Is there any good way to know whether a given .NET class is using IO Completion Ports? (without having to run some tests every time you use a new class. I tried the msdn docs for some classes and methods, and I couldn't find anything on it. Even better, would be if there is some list out there with a list of classes using IOCP.