Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News The Complete List of Migration Issues Upgrading to .NET 4.0

The Complete List of Migration Issues Upgrading to .NET 4.0

This item in japanese

Microsoft has published a complete list of issues migrating from .NET Framework 3.5 SP1 to .NET 4.0. The list contains changes in 6 domains: Core, ASP.NET, ADO.NET, WCF, WPF, and XML.

.NET applications compiled for .NET 3.5 run without any problem if .NET Framework 4.0 is installed on the same machine because the two frameworks are installed in parallel and do not interfere with each other. But there are problems if an application is recompiled for .NET 4.0 because Microsoft’s latest runtime introduces some breaking changes but also some enhancements.

The changes appear in the following 6 domains:

The list of changes is relatively long, so we won’t cover them here. Some of them are:


Application configuration file name change “If your application configuration file is named application-name.config, rename it to application-name.exe.config. For example, renameMyApp.config toMyApp.exe.config.”
Code Access Policy has been turned off. See Code Access Security Policy Compatibility and Migration.


Apps running trusted code in the global cache might fail due to CAS policy change. See Code Access Security in ASP.NET 4 Applications.
ASP.NET 2.0 apps installed on IIS 6.0 may generate errors after ASP.NET 4.0 is installed. Either disable ASP.NET 4.0 or move ASP.NET 2 apps to an IIS instance that does not have ASP.NET 4 installed.
The Page Parser in ASP.NET 4.0 is stricter. Errors generated by invalid markup should be fixed.


Streams “WCF Data Services no longer closes the underlying stream for read and write operations.”
Events “A System.Data.Linq.EntitySet(Of TEntity) collection now raises the ListChanged event for add and remove operations if the EntitySet(Of TEntity) is unloaded, in addition to raising the event when the collection is loaded.”
Queries “Skip(0) is no longer ignored in LINQ to SQL queries. As a result, queries that have this method might behave differently. For example, in some cases, an OrderBy clause is required with Skip(0) and the query will now throw a NotSupportedException exception if the OrderBy clause was not included.”


Configuration files WCF support merging across config files.
Service hosting “You can no longer specify the <serviceHostingEnvironment> configuration element at the service level by adding the attribute allowDefinition="MachineToApplication" to the element definition.

Specifying the <serviceHostingEnvironment> element at the service level is technically incorrect and causes inconsistent behavior.”


Exception handling “To enable errors to be detected earlier, WPF throws a TargetInvocationException and sets the InnerException property to critical exceptions, such as NullReferenceException, OutOfMemoryException, StackOverflowException, and SecurityException, instead of catching the original exception.”
Windows style “An InvalidOperationException is thrown if you try to set WindowStyle to a value other thanNone when AllowsTransparency is true andWindowState is Minimized.”
Dialog boxes “To improve reliability, the CommonDialog.ShowDialogmethod is called on the same thread that created theMicrosoft.Win32.FileDialog control.”


Namespace resolvers “The XmlReader.ReadContentAs method no longer ignores the IXmlNamespaceResolver resolver passed to it.”
Whitespace “To prevent data loss when you are creating a reader, the XmlReader.Create method no longer discards significant white space.”

Rate this Article