Early warning on obsolete members coming in .NET Framework 2.0 (Whidbey)

We have a very cool report we run every week over the entire .NET Framework that shows which members were obsoleted. As I was reviewing that list, I thought that this would be great information to get out to customers right away. After all if you are using V1.0 or V1.1 of the .NET Framework you may not have time to pick up each of our community preview bits and try them out. By making this kind of information available to you in an easy way, it gives you a chance to get a glimpse at the changes that are coming.

Keep in mind that these are just obsolete in V2.0, not removed, so you can still use them in 2.0, but you should start making your way off them. Also, I notice many of them suggest using members that are new in Whidbey (such as SafeHandles), clearly you can’t do anything in your codebase today to make that move.

And, of course the standard caveats apply: this is pre-release, subject to change, etc, etc.

I have included just MsCorLib here, assuming folks think it is interesting I will find a way to do the other DLLs as well. Feedback on the message text is also welcome….

System.AppDomain

GetCurrentThreadId()

Message: AppDomain.GetCurrentOSThreadID has been deprecated because it does not provide a stable ID when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the Thread object returned from Thread.CurrentThread.

 

System.Threading.Overlapped

Pack(IOCompletionCallback iocb)

Message: This method is not safe. Use Pack (iocb, userData) instead.

UnsafePack(IOCompletionCallback iocb)

Message: This method is not safe. Use UnsafePack (iocb, userData) instead.

Overlapped(Int32 offsetLo,Int32 offsetHi,Int32 hEvent,IAsyncResult ar)

Message: This constructor is not 64-bit compatible. Use the constructor that takes an IntPtr for the event handle.

EventHandle

Message: This property is not 64-bit compatible. Use EventHandleIntPtr instead.

 

System.Threading.Thread

Suspend()

Message: Thread.Suspend has been deprecated because code that uses it is very deadlock-prone. Synchronization of threads or mutually-exclusive access to protected resources should be accomplished using other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore.

Resume()

Message: Thread.Resume has been deprecated because code that uses it is very deadlock-prone. Synchronization of threads or mutually-exclusive access to protected resources should be accomplished using other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore.

 

System.Diagnostics.SymbolStore.ISymbolBinder

GetReader(Int32 importer,String filename,String searchPath)

Message: This method is not 64-bit compatible. Use the one on ISymbolBinder2 that takes in IntPtr instead.

 

System.Reflection.Assembly

LoadWithPartialName(String partialName)

Message: Please use Assembly.Load() instead.

LoadWithPartialName(String partialName,Evidence securityEvidence)

Message: Please use Assembly.Load() instead.

 

System.Reflection.AssemblyFlagsAttribute

AssemblyFlagsAttribute(UInt32 flags)

Message: This non-typed constructor will be removed.

AssemblyFlagsAttribute(Int32 assemblyFlags)

Message: This non-typed constructor will be removed.

Flags

Message: This non-typed accessor will be removed.

 

System.Runtime.InteropServices.Marshal

GetTypeLibName(UCOMITypeLib pTLB)

Message: Use System.Runtime.InteropServices.Marshal.GetTypeLibName(ITypeLib pTLB) instead.

GetTypeLibGuid(UCOMITypeLib pTLB)

Message: Use System.Runtime.InteropServices.Marshal.GetTypeLibGuid(ITypeLib pTLB) instead.

GetTypeLibLcid(UCOMITypeLib pTLB)

Message: Use System.Runtime.InteropServices.Marshal.GetTypeLibLcid(ITypeLib pTLB) instead.

GetTypeInfoName(UCOMITypeInfo pTI)

Message: Use System.Runtime.InteropServices.Marshal.GetTypeInfoName(ITypeInfo pTLB) instead.

ReleaseThreadCache()

Message: This API did not perform any operation and will be removed in future versions of the CLR.

 

System.Runtime.InteropServices.BIND_OPTS (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.BIND_OPTS instead.

 

System.Runtime.InteropServices.UCOMIBindCtx (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IBindCtx instead.

 

System.Runtime.InteropServices.UCOMIConnectionPointContainer (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IConnectionPointContainer instead.

 

System.Runtime.InteropServices.UCOMIConnectionPoint (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IConnectionPoint instead.

 

System.Runtime.InteropServices.UCOMIEnumMoniker (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IEnumMoniker instead.

 

System.Runtime.InteropServices.CONNECTDATA (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.CONNECTDATA instead.

 

System.Runtime.InteropServices.UCOMIEnumConnections (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IEnumConnections instead.

 

System.Runtime.InteropServices.UCOMIEnumConnectionPoints (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IEnumConnectionPoints instead.

 

System.Runtime.InteropServices.UCOMIEnumString (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IEnumString instead.

 

System.Runtime.InteropServices.UCOMIEnumVARIANT (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IEnumVARIANT instead.

 

System.Runtime.InteropServices.FILETIME (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.FILETIME instead.

 

System.Runtime.InteropServices.UCOMIMoniker (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IMoniker instead.

 

System.Runtime.InteropServices.UCOMIRunningObjectTable (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IRunningObjectTable instead.

 

System.Runtime.InteropServices.STATSTG (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.STATSTG instead.

 

System.Runtime.InteropServices.UCOMIStream (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IStream instead.

 

System.Runtime.InteropServices.DESCKIND (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.DESCKIND instead.

 

System.Runtime.InteropServices.BINDPTR (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.BINDPTR instead.

 

System.Runtime.InteropServices.UCOMITypeComp (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.ITypeComp instead.

 

System.Runtime.InteropServices.TYPEKIND (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.TYPEKIND instead.

 

System.Runtime.InteropServices.TYPEFLAGS (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.TYPEFLAGS instead.

 

System.Runtime.InteropServices.IMPLTYPEFLAGS (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IMPLTYPEFLAGS instead.

 

System.Runtime.InteropServices.TYPEATTR (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.TYPEATTR instead.

 

System.Runtime.InteropServices.FUNCDESC (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.FUNCDESC instead.

 

System.Runtime.InteropServices.IDLFLAG (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IDLFLAG instead.

 

System.Runtime.InteropServices.IDLDESC (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.IDLDESC instead.

 

System.Runtime.InteropServices.PARAMFLAG (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.PARAMFLAG instead.

 

System.Runtime.InteropServices.PARAMDESC (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.PARAMDESC instead.

 

System.Runtime.InteropServices.TYPEDESC (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.TYPEDESC instead.

 

System.Runtime.InteropServices.ELEMDESC (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.ELEMDESC instead.

 

System.Runtime.InteropServices.VARDESC (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.VARDESC instead.

 

System.Runtime.InteropServices.DISPPARAMS (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.DISPPARAMS instead.

 

System.Runtime.InteropServices.EXCEPINFO (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.EXCEPINFO instead.

 

System.Runtime.InteropServices.FUNCKIND (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.FUNCKIND instead.

 

System.Runtime.InteropServices.INVOKEKIND (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.INVOKEKIND instead.

 

System.Runtime.InteropServices.CALLCONV (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.CALLCONV instead.

 

System.Runtime.InteropServices.FUNCFLAGS (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.FUNCFLAGS instead.

 

System.Runtime.InteropServices.VARFLAGS (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.VARFLAGS instead.

 

System.Runtime.InteropServices.UCOMITypeInfo (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.ITypeInfo instead.

 

System.Runtime.InteropServices.SYSKIND (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.SYSKIND instead.

 

System.Runtime.InteropServices.LIBFLAGS (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.LIBFLAGS instead.

 

System.Runtime.InteropServices.TYPELIBATTR (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.TYPELIBATTR instead.

 

System.Runtime.InteropServices.UCOMITypeLib (Type Obsoleted)

Message: Use System.Runtime.InteropServices.ComTypes.ITypeLib instead.

 

System.IO.FileStream

FileStream(IntPtr handle,FileAccess access)

Message: Use the FileStream constructor family that takes a SafeFileHandle instead.

FileStream(IntPtr handle,FileAccess access,Boolean ownsHandle)

Message: Use the FileStream constructor family that takes a SafeFileHandle instead. Note SafeFileHandle will allow you to specify whether it owns this handle.

FileStream(IntPtr handle,FileAccess access,Boolean ownsHandle,Int32 bufferSize)

Message: Use the FileStream constructor family that takes a SafeFileHandle instead. Note SafeFileHandle will allow you to specify whether it owns this handle.

FileStream(IntPtr handle,FileAccess access,Boolean ownsHandle,Int32 bufferSize,Boolean isAsync)

Message: Use the FileStream constructor family that takes a SafeFileHandle instead. Note SafeFileHandle will allow you to specify whether it owns this handle.

Handle

Message: Please use FileStream's SafeFileHandle property instead.

 

System.IO.IsolatedStorage.IsolatedStorageFileStream

Handle

Message: Please use IsolatedStorageFileStream's SafeFileHandle property instead.

 

System.Configuration.Assemblies.AssemblyHash (Type Obsoleted)

Message: The AssemblyHash class is scheduled to be removed.