when reflecting on mscorlib.Contracts.dll, and browsing to System.Reflection.MemberInfo.DeclaringType, I see the following:
Contract.Ensures((bool) (Contract.Result<Type>() != null), null, "Contract.Result<Type>() != null");
The postcondition is wrong, consider for example the declaring type of a top level type, such as typeof(int).DeclaringType, which returns null.
Thanks for reporting this, I weakened the contract to:
Contract.Ensures(Contract.Result<Type>() != null || MemberType == MemberTypes.TypeInfo);
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?