You receive an incorrect value from the
DateTime.TryParse method when you use codes that resemble the following:
DateTime dt = DateTime.Parse("4/21 5pm");
Console.WriteLine(dt.ToString());
if (DateTime.TryParse("4/21 5pm", out dt))
{
Console.WriteLine(dt.ToString());
}
Console.ReadLine();
Note In this example, the
DateTime.TryParse method incorrectly returns the time of 4:00 P.M. as today’s date.
ResolutionAfter you install the hotfix, the method tries to parse this specific pattern correctly.
To enable this hotfix, add the following code in the application configuration file:
<configuration>
<runtime>
<EnableAmPmParseAdjustment enabled=”1” />
</runtime>
</configuration>
Note the hotfix does not affect the system's time and date settings.
Issue 2When you run the following code pattern by using open generics, an unhandled exception occurs at run time:
[InheritedExport]
interface ITest2<T>
{
void Execute();
}
class TestClass2<T> : ITest2<T>
{
public void Execute()
{
Console.WriteLine();
}
}
class Program
{
static void Main(string[] args)
{
var catalog = new AssemblyCatalog(typeof(Program).Assembly);
var container = new CompositionContainer(catalog);
var test2 = container.GetExportedValues<ITest2<string>>();
}
}
Issue 3You receive a
CryptographicException error when you parse the
System.Security.Cryptography.Oid object.
Issue 4In a multithread console application, the
Console.ReadKey method may block the call to the
Console.InputEncoding property from another thread.
Issue 5You receive an access denied error when you try to install an assembly that is shared together with Visual Studio in the Global Assembly Cache (GAC). Additionally, The effected assembly can be broken when it is removed from the system. This issue cannot be resolved even after you restart the computer.
Issue 6The
ConcurrentQueue<T>.TryPeek method returns
true. However, the object returned is
null.
WPF
Issue 1Assume that you try to call the
PrintQueue.AddJob(string jobName, string documentPath, bool fastCopy) method to print an XML Paper Specification (XPS) document on an XPS printer, and the
fastCopy parameter is set to
true. In this situation, the following issues occur:
- Print tickets that are embedded in the document are ignored.
- The preview dialog box pops up in a loop.
Issue 2When the
Content property of a ContentControl control (such as, a Button control) is set to a RoutedCommand command, the control cannot display the name of the routed command. For example, you use the following code to set the
ApplicationCommands.Paste command to a Button control in the Microsoft .NET Framework 4.5 or in the Microsoft .NET Framework 4:
<Button Content="{x:Static ApplicationCommands.Paste}" />
In this situation, the Button incorrectly displays "System.Windows.Input.SecureUICommand" in the .NET Framework 4.5. However, the Button correctly displays "Paste" in the .NET Framework 4.
Issue 3Assume that a large collection is bound to the control that supports multiple selections, such as ListBox or DataGrid. When you call the
SelectedItems.Add method, you experience slow performance even if the added item is near the beginning of the collection.
Note In .NET Framework 4, you experience slow performance when the added item is near the end of the collection.
Issue 4The hit target for content that contains small-sized text is larger than the content. When you click outside the actual bounds of the content, a click event or another corresponding event is triggered. This issue occurs when the text size decreases and the scaling factors increase.
Issue 5Assume that you change a selector property (such as, the
SelectedItem property) or
ComboBox.Text property by using a binding path that contains a static property. In this situation, the binding does not react to the changes. Specifically, the new value is not written to the data item.
Issue 6you run a .NET Framework 4.5-based WPF application on a computer that contains multiple display adapters, black bars can appear on the WPF window. This typically occurs if the WPF window is dragged from a monitor on one adapter to another monitor on a different adapter.
Issue 7When you encounter unhandled exceptions in Windows Forms content that is hosted in a .NET Framework 4.5-based WPF application, the WPF application crashes. For example, you encounter an unhandled exception when a WPF application uses the
<WindowsFormsHost> XAML object element.
Issue 8When you type inside a Combo Box control that received focus for the first time by using the TAB key, you receive a
NullReferenceException exception and the WPF application crashes.
Windows Forms
Issue 1Assume that you define a custom control that includes a property that can be designer-serialized, and comes with a
[DefaultValue()] attribute that results in implicit type casting.
For example, the following property type is "short" and the default value is specified as an "Int32":
[DefaultValue(2)]
public short Number { get; set; }
In this scenario, when Visual Studio Windows Forms Designer serializes or de-serializes this control, a
System.ArgumentException is thrown.
Issue 2Consider the following scenario:
- You define a base interface and a derived interface.
- You hide the base interface property by using a "new" modifier in the derived interface. For example, you use the following code:
public interface IInterfaceA
{
int PropertyA { get; set; }
int PropertyB { get; set; }
}
public interface IInterfaceB : IInterfaceA
{
new int PropertyA { get; set; }
int PropertyD { get; set; }
}
- You use the derived interface as the argument in the ListBindingHelper.GetListItemPropertiesAPI.
In this scenario, the properties that are defined on the derived interface are returned in the .NET Framework 4. This occurs because the reflection does not return properties that are defined in the base class. However, in .NET Framework 4.5, properties from the base class are included. Furthermore, the
ListBindingHelper.GetListItemProperties API returns two instances of a property that is called "PropertyA".
ResolutionThis update reverts the
ListBindingHelper.GetListItemProperties API to the .NET Framework 4 behavior. This API is invoked at design time when IInterfaceB is set as a data source on a control (such as, a
DataGridView control).
System.Messaging
Consider the following scenario:
- You use System.Messaging or MSMQ in a workgroup environment.
- You use the MessageQueue.GetPrivateQueuesByMachine method to retrieve an array of MessageQueue objects for all private queues on a remote computer in the workgroup.
In this scenario, you encounter a
MessageQueueException exception, and the following error message is received:
Invalid queue path name.
Windows Communication Foundation (WCF)
In the .NET Framework 4.5, WCF introduces a new method named "Reflection Emit" that generates the XML Serialization assembly. This method enables scenarios where the client application cannot write a temporary serialization assembly to disk. In some cases, this may cause issues after you upgrade to the .NET Framework 4.5.
The ability to opt out of this new behavior and revert to the WCF 4 XML serialization is documented in the following KB article:
2748720 Serialization or deserialization failures when you run existing XML serialization code in WCF 4.5
In a .NET Framework 4.5-based application, you can use the following code as the workaround that is described in KB 2748720:
<configuration> <system.xml.serialization> <xmlSerializer useLegacySerializerGeneration="true"/> </system.xml.serialization> <configuration>
Assume that you also use the same application.config file or web.config file to target both the .NET Framework 4 and the .NET Framework 4.5. In this situation, you encounter an exception that indicates the
<xmlserializer> element cannot be recognized under the
<system.xml.serialization> attribute.
For applications that try to target the .NET Framework 4 and the .NET Framework 4.5, we recommend that you apply the following <appSetting> configuration to a replace the previous switch:
<appSettings> <add key="System:Xml:Serialization:UseLegacySerializerGeneration" value="true"/> </appSettings>
Notes - Both switches work in the .NET Framework 4.5. However, the <appSettings> switch will make sure that the app.config file or web.config file can be transferred between the .NET Framework 4.0 and the .NET Framework 4.5. If you apply both the switches, only the <appSettings> switch will be used.
- When a .NET Framework 4.0 application uses the "UseLegacySerializerGeneration" configuration element, the application returns a configuration error.
This update also resolves the following issues after you upgrade to the .NET Framework 4.5.
Issue 1When you deserialize simple arrays that are serialized as an XmlAttribute, the operation fails. Additionally, you receive the following error message:
System.XML.XmlException ‘EndElement’ is an invalid XmlNode Type.
After you upgrade to .NET Framework 4.5, IIS may return an
HTTP400 - 'Bad Request' error.
Issue 2Consider the following scenario:
- A base class "A" and a derived class "B" try to serialize or deserialize an object of "B".
- A virtual property is defined in "A" and is overridden by "B".
In this scenario, the serializer outputs the property that is defined in "A" instead of "B".