View Complete Post
I was seeing a "The supplied handle is invalid" message in CryptographicExceptions intermittently, so I created the following program to reproduce the problem based on the hunch that there was a concurrency issue. Originally the problem was occurring when
encrypting data, but I've pruned away as much code as I can to make it smaller/easier to understand (of course the KeyWork method doesn't do too much).
Note: this is CPU intensive and takes a while to complete. Sorry.
public class P
public static void Main()
byte public_encrypting_key = StringToByteArray("45434B3542000000016FE13A42A9D54503BC694E9E298760FC03BA99FB224691BF03830BA9FB58354227541F120667843A8813628ADA70126EA06CBCB3537A1986283D3FA3612F124673010CA5F372A32B50E6B648F61DCF70B3E3782324AA6795891ACD8B87F9CA89F128BD
Visual Studio 2010 includes new resource contention profiling features that help detect concurrency contention among threads. We walk through a profiling investigation to demonstrate how you can pinpoint and fix resource contention problems in your code.
MSDN Magazine June 2010
Understanding performance bottlenecks in multithreaded apps used to require significant instrumentation and analysis by expert developers. The Concurrency Visualizer in Visual Studio 2010 significantly reduces the burden of parallel performance analysis.
MSDN Magazine March 2010
Getting the performance you want in concurrent applications is not as straightforward as you might think. See how common threading issues can affect your application.
Erika Fuentes and Eric Eilebrecht
MSDN Magazine December 2008
Introducing the issue, Howard Dierking points out that you can't simply parallelize your code blindly if you expect to truly reap the benefits that parallelism promises.
MSDN Magazine October 2008
The new threadpool APIs in Windows Vista and in the upcoming Windows Server 2008 provide advances that even native Windows developers can benefit from.
MSDN Magazine October 2007
In my last column, I showed the various thread synchronization mechanisms employed by the MicrosoftÃÂ® . NET Framework (see Concurrent Affairs: Performance-Conscious Thread Synchronization). I then examined the performance characteristics of all these mechanisms and determined that the Interlocked methods performed the best because the calling thread never has to transition to kernel mode.
MSDN Magazine March 2006
In my career, I have architected and implemented many thread synchronization techniques. This has provided me with a lot of experience that has shaped the way I now think about thread synchronization problems.
MSDN Magazine October 2005
MSDN Magazine February 2005
Until now, Microsoft did not provide explicit support in the .NET Framework for manipulating security settings. With the .NET Framework 1.x, access can only be granted to users via a series of cumbersome P/Invoke calls. By introducing the concepts of security objects and rules, the .NET Framework 2.0 allows developers to manipulate security settings of objects in a few easy steps using managed code. Want to know more? Read on.
MSDN Magazine November 2004
My last three Basic Instincts columns have examined techniques for using asynchronous delegates and creating secondary threads. Those columns demonstrated how to introduce multithreaded behavior into your applications.
MSDN Magazine September 2004
MSDN Magazine May 2004
How does the thread pool work in the CLR?
MSDN Magazine June 2003
By far, the most common use of thread synchronization is to ensure mutually exclusive access to a shared resource by multiple threads. In the Win32ÃÂ® API, the CRITICAL_SECTION structure and associated functions offers the fastest and most efficient way to synchronize threads for mutually exclusive access when the threads are all running in a single process.
MSDN Magazine January 2003
Windows CE is a small, configurable, feature-rich, real-time operating system. In Windows CE 3.0, the real-time support has been improved. This article looks at specific support for the creation of real-time systems and how it compares to the support in Windows for the desktop. The way interrupt handlers, processes, memory management, and synchronization work in Windows CE 3.0 is discussed. An extensive look at threads and thread priority, misconceptions surrounding them, and their impact on performance is included. Refinements to the Windows CE scheduler and support for nestable interrupts are also covered.
MSDN Magazine November 2000