Runtime Changes in the .NET Framework 4.5.1

.NET Framework (current version)

In rare cases, runtime changes may affect existing apps that target the .NET Framework 4 or 4.5 but run on the 4.51 runtime. They include changes in the following areas:

The Scope column in the following tables specifies the significance of each change:

  • Major. A significant change that affects a large number of apps or that requires substantial modification of code. Note that none of the runtime changes fall into this category.

  • Minor. A change that either affects a small number of apps or that requires minor modification of code.

  • Edge. A change that affects apps under very specific scenarios that are not common.

  • Transparent. A change that has no noticeable effect on the app's developer or user. The app should not require modification because of this change.

System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue> serializationA ConcurrentDictionary<TKey, TValue> object serialized in the .NET Framework 4.5 with the NetDataContractSerializer cannot be deserialized in the .NET Framework 4.5.1 and 4.5.2 only because of internal changes in the type.

This change does not apply in the following scenarios:

A ConcurrentDictionary<TKey, TValue> object serialized in the .NET Framework 4.5 and deserialized in the .NET Framework 4.6. The NetDataContractSerializer in the .NET Framework 4.6 is able to deserialize the object.

A ConcurrentDictionary<TKey, TValue> object serialized in a later version of the .NET Framework and deserialized in the .NET Framework 4.5. The NetDataContractSerializer in the .NET Framework 4.5 is able to deserialize the object.

Inter-version serialization and deserialization of a ConcurrentDictionary<TKey, TValue> object between any version of the .NET Framework after the .NET Framework 4.5. This change applies to objects serialized with the .NET Framework 4.5 only.
Two workarounds are available if it is necessary to serialize a ConcurrentDictionary<TKey, TValue> object on the .NET Framework 4.5 and deserialize it on a later version of the .NET Framework:

Use an alternate serializer, such as the DataContractSerializer or the BinaryFormatter.

Upgrade to the .NET Framework 4.6, which supports deserialization of ConcurrentDictionary<TKey, TValue> object serialized with the .NET Framework 4.5.
System.Diagnostics.Tracing.EventListener classEventListener truncates strings with embedded nulls. Null characters are not supported by the EventSource class.The change only affects apps that use EventListener to read EventSource data in process and that use null characters as delimiters.Edge
System.Diagnostics.Tracing.EventSource classThe runtime now enforces the contract that specifies the following: A class derived from EventSource that defines an ETW event method must call the base class EventSource.WriteEvent method with the event ID followed by the same arguments that the ETW event method was passed.An IndexOutOfRangeException exception is thrown if an EventListener reads EventSource data in process for an event source that violates this contract.

See Mitigation: EventSource.WriteEvent Method Calls
Deserialization of objects across application domainsIn some cases, when an app uses two or more app domains with different application bases, trying to deserialize objects in the logical call context across app domains throws an exception.This issue arises in a highly specific scenario. For more information and mitigation, see Mitigation: Deserialization of Objects Across App Domains.Edge
Stream.Dispose methodIn Windows Store apps, Windows Runtime stream adapters no longer call the FlushAsync method from the Dispose method.This change should be transparent. Developers can restore the previous behavior by writing code like this:

 using (System.IO.Stream stream = GetWindowsRuntimeStream() As Stream) { // do something await stream.FlushAsync(); }

minFreeMemoryPercentageToActiveService configuration settingThe setting establishes the minimum memory that must be available on the server before a WCF service can be activated. It is designed to prevent OutOfMemoryException exceptions. In the .NET Framework 4.5, this setting had no effect. In the .NET Framework 4.5.1, the setting is observed.An exception occurs if the free memory available on the web server is less than the percentage defined by the configuration setting. Some WCF services that successfully started and ran in a constrained memory environment may now fail.

See Mitigation: minFreeMemoryPercentageToActiveService Configuration Setting.

Retargeting Changes
Application Compatibility in 4.5
Application Compatibility in 4.5.2