This is perhaps not a tip as such, except that reading MSDN magazine is something every .NET developer should do regularly - so my tip would be to read each edition.
There are many, many useful MSDN articles and I just want to provide links to some that provide very useful information for those of us that work with that platform.
- Marshaling between Managed and Unmanaged Code[^] by Yi Zhang and Xiaoying Guo - January 2008
Interesting tidbits about P/Invoke, including a few tricks that can be used to ensure efficient buffer management. The authors also give a detailed explanation about the things you need to know when calling managed code from native code.
- CLR Hosting APIs[^] by Alessandro Catorcini and Piotr Puszkiewicz - August 2006
A brief introduction to the CLR hosting APIs. The article is pretty short for such a complex topic, but the authors manage to show how CLR hosting APIs fits together.
- Understanding The CLR Binder[^] by Aarthi Ramamurthy and Mark Miller - May 2009
The CLR Binder locates the assemblies at run time and binds to them, so understanding how it works is pretty useful.
- Introduction to COM Interop[^] by Thottam R. Sriram - January 2007
COM is a pretty useful technology, and Microsoft spent a lot of effort making integration between .NET and COM as painless as possible. This article gives a thorough introduction to the basics of COM interop.
If you want to learn more, Adam Nathan has written an excellent book .NET and COM: The Complete Interoperability Guide[^] which covers just about all you could possibly want to know about the subject.
- Best Practices For Managed And Native Code Interoperability[^] by Jesse Kaplan - January 2009
Good advice on when to use P/Invoke, COM Interop or C++/CLI.
- Managing Object Lifetime[^] by Tim Fischer - November 2007
That .NET has a garbage collector does not mean that we can forget about resource management, and this article touches on some of the thornier issues related to this.
- Exploring the .NET Framework 4 Security Model[^] by Andrew Dai - November 2009
If you are interested in .NET security, Shawn Farkas’ .NET security blog[^] provides a lot of valuable information too.
- Credentials and Delegation[^] by Keith Brown - September 2005
If you negotiate down to NTLM, delegation is not going to work. For example, if either the Web server or SQL Server is running under a local account (such as the default ASPNET account on Windows 2000) or the built-in Local Service account, Kerberos cannot be used, so NTLM will be negotiated, and delegation will not work. In order to have a chance at negotiating Kerberos, both client and server must be using domain accounts to authenticate.
In my experience, this is the most common source for problems related to delegation.
- What Every Dev Must Know About Multithreaded Apps[^] by Vance Morrison - August 2005
A good introduction to .NET multi-threading
- Understand the Impact of Low-Lock Techniques in Multithreaded Apps[^] by Vance Morrison - October 2005
A good detailed treatment of locks, which type to use and where to use them
- Thread Management In The CLR[^] by Erika Fuentes and Eric Eilebrecht - December 2008
Tidbits about .NET concurrency
- Digging into IDisposable[^] by Shawn Farkas - October 2005
It's worth noting that sometimes
void Dispose(bool disposing) is incorrectly implemented like this:
protected virtual void Dispose(bool disposing)
Obviously, this turns
Dispose into a mandatory operation. The information about security and garbage collection is also well worth noting. So basically, you should never rely on the garbage collector cleaning up native resources correctly and always make sure you call
- Writing Reliable .NET Code[^] by Alessandro Catorcini and Brian Grunkemeyer and Brian Grunkemeyer - December 2007
The article provides insights that are useful when you have to write reliable applications, and it explains why your web application may be terminated at any time – something that seems to surprise a lot of people.