直播中
good luck!
Change List: Beta 2 to Build RTM
The following document contains a list of the changes to the .NET Framework class libraries, compilers (and languages), and SDK tools between the stated builds.
If you have any questions regarding this change list, send e-mail to netfwsdk@microsoft.com.
ClassLib Changes
• Switched to new W3c Xsd Schema 2001 types for Remoting SOAP and WSDL Engines.
To be compatible with other SOAP and WSDL engines that are moving to the new XSD Schema (ASMX, ATL, SOAP toolkit, etc.), Remoting will replace the existing Soap* types in System.Runtime.Remoting.Metadata (the Soap*Attributes will remain) with types in System.Runtime.Remoting.Metadata.W3cXsd2001 that map between common language runtime types and Xsd types.
The following types in System.Runtime.Remoting.Metadata will be removed:
SoapCdata
SoapCentury
SoapDate
SoapInteger
SoapMonth
SoapNegativeInteger
SoapNonNegativeInteger
SoapNonPositiveInteger
SoapPositiveInteger
SoapRecurringDate
SoapRecurringDay
SoapTime
SoapTimeDuration
SoapTimeInstant
SoapYear
The following types in System.Runtime.Remoting.Metadata.W3cXsd2001 will be added:
SoapTime
SoapDate
SoapYearMonth
SoapYear
SoapMonthDay
SoapDay
SoapMonth
SoapHexBinary
SoapBase64Binary
SoapInteger
SoapPositiveInteger
SoapNonPositiveInteger
SoapNonNegativeInteger
SoapNegativeInterger
SoapAnyUri
SoapQName
SoapNotation
SoapNormalizedStr
• ServicedComponent Proxy and Remoting Related Cleanup
The following classes/methods will be removed:
1. public class System.Runtime.Remoting.Contexts.ThreadAffinityAttribute - currently marked as Obsolete.
2.Context.UnregisterDynamicProperty - currently marked as Obsolete (the UnregisterDynamicProperty overloaded method that takes a ContextBoundObject will remain).
public class System.Runtime.Remoting.Contexts.Context
{
//. . . - currently marked as Obsolete
public static bool UnregisterDynamicProperty(String name, MarshalByRefObject obj, Context ctx)
//. . .
}
3.SoapServices.PreLoad - currently marked as Obsolete.
public class System.Runtime.Remoting.SoapServices
{
//. . .
public static void PreLoad(Assembly assembly, bool bServer)
//. . .
}
• Removed the finalizer and removed Dispose(bool) from Stream, and added the finalizer to FileStream.
To better comply with the design pattern regarding the usage if IDisposable, the finalizer from Stream was removed and placed on FileStream. To further reflect the design pattern, we also removed the implementation of Dispose from Stream that accepted a bool.
• Changed the System.Reflection.Emit.MethodBuilder.InitLocals property so that the default is true.
The InitLocals property on MethodBuilder indicates to the runtime whether the method should initialize local variables to 0 on entry to the method. The default for this property used to be false, but now the default is true.
This change was needed so that MethodBuilder will generate verifiable code by default (the JIT now requires this bit to be set to be verifiable).
This change should not affect anything, since presumably all variables were set before use in code that did not set the InitLocals so the zero initialization will not be visible.
The JIT compiler will remove the redundant stores, so there should be no impact on the performance from this change.
• Removed DataSet.GetNestedChanges.
GetNestedChanges was added in a recent, post-B2 build as a way to return the parents of rows with changes. However, this functionality already appears in DataSet.GetChanges to support foreign key constraints that can exist on the changed rows.
Previous code:
// code prior to recent change
// DataSet myDataSet.GetChanges();
// Get Changes with Parents
DataSet myDataSet.GetNestedChanges();
// code prior to recent change
// DataSet myDataSet.GetChanges();
// Get Changes with Parents
DataSet myDataSet.GetChanges();
' code prior to recent change
' DataSet myDataSet.GetChanges()
' Get Changes with Parents
DataSet myDataSet.GetChanges()
This method appeared in a post-B2 build. It has been removed for RTM.
Visual Basic .NET
• Changed name hiding semantics in Visual Basic .NET:
The changes include:
1.?Overloads? will no longer be required for overloading within a type, but will still be allowed.
2.If one overloaded method in a class specifies ?Overloads?, then they all must.
3.?Shadows? and ?Overloads? cannot be specified together on a declaration.
4.If a method specifies neither ?Overloads? nor ?Shadows?, then ?Shadows? is assumed.
5.If a method conflicts with a name in a base class, then either ?Shadows? or ?Overloads? must be specified, or a warning will be issued.
6.?Overloads? means that a method shadows by name and signature; and ?Shadows? means that a method shadows by name.
7.?Overloads? is not allowed on an instance constructor (since they are not inherited).
Common Language Runtime
The following opcodes have been changed so that they take signed numbers:
NEWARR
NEWOBJ (when creating arrays).
This only affects their behavior when given a negative number. Previously, these opcodes treated the negative number as an unsigned number (which would look very big), and thus threw an OutOfMemoryException. Now they will throw an OverflowException.
The C# compiler already performed this test implicitly, so C# code will not notice this change (they already did the new semantics).
Only code that catches OutOfMemoryException may need to change.
No changes need to be made for C# because the compiler emitted extra MSIL that already implemented the new semantics.
If you catch OutOfMemoryException to catch the case where negative numbers are passed to array creation operators, you need to catch OverflowException instead.
• Some .NET Framework common language runtime perf counters are no longer valid and have been converted into Reserved counters. Also, some counters were not formatted correctly, and have been changed to make them look the same.
Old Form New Form
Gen 0 heap size Gen 0 Heap Size
Gen 1 heap size Gen 1 Heap Size
Gen 2 heap size Gen 2 Heap Size
# Total committed Bytes # Total Committed Bytes
# Total reserved Bytes # Total Reserved Bytes
# of Sink Blocks in use # of Sync Blocks in Use
Assembly Search Length Reserved
Total appdomains unloaded Total AppDomains Unloaded
Rate of appdomains unloaded Rate of AppDomains Unloaded
Current appdomains Current AppDomains
Total Appdomains Total AppDomains
Rate of appdomains Rate of AppDomains
Standard Jit Failures Jit Failures
# of marshalling # of Marshalling Calls
# of TLB imports / sec Reserved #1
# of TLB exports / sec Reserved #2
# of current logical Threads # of Current Logical Threads
# of current physical Threads # of Current Physical Threads
# of current recognized threads # of Current Recognized Threads
# of total recognized threads # of Total Recognized Threads
rate of recognized threads / sec Rate of Recognized Threads
Security
• Changed System.Security.Cryptography.
ICryptoTransform now has the IDisposable interface. The new property, SymmetricAlgorithm, and AssymetricAlgorithm also implement IDisposable now, which allows for deterministic finilalization of crypto transforms.
In keeping with design guidelines, the dispose member was named Clear, which fits better for crypto.
• Verifiable code must now set the initlocal's bit on the method.
Every MSIL method has a bit that indicates whether local variables will
automatically be initialized to 0 by the JIT compiler. This bit must
now be set for code that has local variables, if it is to be verifiable.
This change generally only affects MSIL compilers that want to emit
verifiable code. C# and Visual Basic already conform to this change. ReflectionEmit
has been changed, so it also sets this bit by default. Thus scripting
is also covered. Third party compilers that generate PE files directly
or use ILASM need to be updated, if verifiability is a concern.
There should be very little performance change because of this. The
JIT compiler already eliminates most dead stores, and thus will not double
initialize variables.
For ILASM replace
.locals
with
.locals init.
• Removed DemandImmediate.
DemandImmediate has been removed everywhere that it is defined. This includes the following:
CodeAccessPermission.DemandImmediate
IPermission.DemandImmediate
IStackWalk.DemandImmediate
PermissionSet.DemandImmediate
PrincipalPermission.DemandImmediate.
Any class that extends CodeAccessPermisison has also been removed.
This is being done to eliminate a security vulnerability in which DemandImmediate could be circumvented by passing a delegate containing one to more trusted code so that the immediate caller would have a higher permission grant. This does not affect regular Demands or declarative LinkDemands.
LinkDemand can be used to perform caller-only security checks. The absence of DemandImmediate, though, prevents runtime caller-only checks using dynamic information (for example, a file name not known until runtime). In general, caller-only checks should be avoided in favor of those that perform a complete stack walk, because the former does not protect against luring attacks, while the latter does. Caller-only identity permission demands, where demand immediate seemed most useful, can still be done by having the caller assert their identity permission if they are safe from misuse by their callers.
• Removed WebPageMembershipCondition and SkipVerificationMembershipCondition.
The classes WebPageMembershipCondition and SkipVerificationMembershipCondition have been removed from the product and are no longer available for use in policy from the tools Caspol.exe and Mscorcfg.msc.
• Enabled HMAC-SHA1 XML Digital Signatures.
API changes in System.Security.dll (System.Security.Cryptography.Xml namespace) to enable HMAC-SHA1 based XMLDSIG digital signatures.
• Enabled HMAC-SHA1 XML Digital Signatures.
API changes in System.Security.dll (System.Security.Cryptography.Xml namespace) to enable HMAC-SHA1 based XMLDSIG digital signatures.
• Array creation opcodes now take signed (previously unsigned) numbers and can throw OverflowException.
ASP.NET Changes
• Changed KeyedHashAlgorithm.
The secret key in KeyedHashAlgorithms is zeroed on Dispose. Instances of CryptoStream, SHA1, and TripleDES used internally in the KeyedHashAlgorithm classes HMACSHA1 and MACTripleDES are also cleaned up.
• Changed System.ComponentModel.Component.Dispose to non-virtual.
Inheriting types should override protected void Dispose(bool) .
• Changed SetItemsCore(object[] items) and SetItemsCore(IList items) to reduce the overhead of populating a databound list in ListControl.
ListControl contains the following abstract method:
protected abstract void SetItemsCore(object[] items);
This method is used to populate the Listbox or ComboBox from a DataSource. Because DataSource is an IList and SetItemsCore takes an array, the contents of the datasource have to be unnecessarily copied into an array.
Miscellaneous
• Changed some APIs in System.EnterpriseServices.ResourcePool to internal.
System.EnterpriseServices.ResourcePool interface change:
Changed the following methods from public to internal:
class:
System.EnterpriseServices.ResourcePool
methods:
GetToken(),
ReleaseToken().
These methods should only be used internally by System.EnterpriseServices components.
Interop
Changes in the interop assembly
Change #1
The fundamental change is in how the coclasses are imported from the type libraries. Before, the coclasses were imported as managed classes. The class could be activated with the new operator and methods could be invoked directly.
In the new design, the coclass is imported as an interface in addition to the class. The interface has the same name as the original coclass. It has an attribute identifying the CLSID of the original class. It also has the same IID as the coclass’s default interface. The imported class has the same name as the coclass with “Class” appended.
Change #2
The second change is parameter substitution in the method signatures. All parameters with, for example, the IFoo type are changed to be of the Foo type unless:
• There is another coclass that implements interface IFoo (as default or non-default interface).
• There is another coclass that implements interface derived from IFoo.
Note: another coclass can be defined in the same type library or any other type library that is imported from the original type library.
With these changes, managed clients can always register as event sinks for unmanaged event sources and not depend on what kind of the runtime callable wrapper (RCW) is created, typed or generic.
For example, consider the following scenario:
BarMethod( IFoo ip )
{
Foo f = (Foo)ip; // cast will fail if wrapped with _ComObject
f.Click += new _FooSource_ClickEventHandler(...);
}
BarMethod( IFoo ip )
{
Foo f = (Foo)ip; // ok now since Foo is an interface
f.Click += new _FooSource_ClickEventHandler(...);
}
Possible changes needed in Beta2 code
• Explicit casting required for the non-default interfaces.
BarMethod( IFoo ip )
{
Foo f = (Foo)ip;
f.BarMeth(); // can’t compile this any more since Foo is an interface
IBar b = (IBar)f; // explicit cast needed, this will QI for IBar
b.BarMeth();
}
• Fixes required in calls that call methods with the changed signatures. This also includes get & set property methods if property value was of type IFoo.
SomeMethod( IFoo ip )
{
// imported method DoSomething is declared as
// DoSomething( Foo ip ) now
// can’t be compiled since the derived interface Foo is expected
DoSomething( ip );
// fix in the call required
DoSomething( (Foo)ip );
}
• Source changes and recompiling needed in all code that is not written in C# or Visual Basic .NET (for example, in existing MC++ code).
All object creation code like:
Foo f = new Foo();
Needs to be changed to:
Foo f = new FooClass();
• Source changes and recompiling needed when inheritance from COM coclass is used.
All code like:
class Cderived : Foo {…}
Needs to be changed to:
class Cderived : FooClass {…}
Static members no longer appear to be supported by managed objects
Under some circumstances, the CLR IDispatch.GetIdsOfNames implementation provided a dispid for a static member of a managed type. Calling Invoke with that dispid will ultimately fail because static members are not callable from COM.
This change causes GetIdsOfNames to fail when requesting the DispId of a static member rather than returning an unusable DispId.
struct** in the type library is imported as IntPtr
Pointer to pointer to structure as parameter in the type library method is imported as IntPtr type. This type was imported as a byref value class with the NATIVE_TYPE_LPSTRUCT attribute applied previously but wasn’t fully functional. Beta2 code that used any interface with this type of parameter in methods should be recompiled.