A first hand look from the .NET engineering teams
Fundamentals were a big part of our focus while building .NET 4.5. We divided fundamentals into seven areas called “tenets”. One of these tenets is compatibility. Today’s post is by Manish Agnihotri, a program manager who is driving compatibility across the .NET Framework. -- Brandon Editor's update: we've added more discussion about the compatibility of .NET Framework 4.5 in a recent post on October 17, 2012.
Fundamentals were a big part of our focus while building .NET 4.5. We divided fundamentals into seven areas called “tenets”. One of these tenets is compatibility. Today’s post is by Manish Agnihotri, a program manager who is driving compatibility across the .NET Framework. -- Brandon
Editor's update: we've added more discussion about the compatibility of .NET Framework 4.5 in a recent post on October 17, 2012.
.NET Framework 4.5 is an in-place update that replaces .NET Framework 4 (rather than a side-by-side installation). Our goal is for .NET 4.5 to be fully backward compatible with applications built for .NET 4 (.NET 3.5 and .NET 4.5 will be side-by-side). We’ll talk about the compatibility story for .NET 3.5 in a later post. One of the first things you’ll notice about .NET 4.5 is the version number (4.0.30319) is the same as .NET 4; this is the practice used by other in-place updates.
Our primary concern is guaranteeing applications you use do not break after you install .NET 4.5. We accomplish this by running hundreds of application in our compatibility lab to find issues as soon as they’re introduced. While designing new features or changing existing code, we keep compatibility in mind. And a small group of us, the Developer Division Compatibility Council (DDCC), monitor changes made by developers. We review potential breaking changes, and help teams understand and assess the compatibility impact of new features and bug fixes. For .NET 4.5, members of DDCC reviewed every proposed breaking change, every new feature, and a majority of the bug fixes for the release.
We’ve put a lot of effort into maintaining a consistently high bar for compatibility across the product, yet we know some issues may get past us. Many applications will exercise the .NET Framework in ways that we did not expect or we lack test coverage for. Still we care about knowing every issue, even those that may seem like corner cases. Once you install .NET 4.5 Developer Preview on a machine that previously had .NET 4, any compatibility issues can be sent to the Connect feedback site.
There are three kinds of version compatibility testing we do: (1) binary compatibility, (2) source compatibility, and (3) serialization compatibility. You may also find these approaches useful in your testing, and should an issue arise this may help you narrow down the root cause. Having a wide range of scenarios within each kind of tests is also critical to ensuring good compatibility coverage.
Binary compatibility uses binaries built targeting .NET 4 and then are run on .NET 4.5. Essentially, we’re testing that the behavior of newer .NET libraries is equivalent to previous versions. This can range from making sure the return value of a function is the same or that the same exceptions are raised. The hardest issues are multi-threading behaviors – sometimes performance improvements can be a breaking change.
Source compatibility takes an application that builds and runs successfully against .NET 4 then does the same with .NET 4.5. An interesting case is a machine where Visual Studio 2010 runs on a machine with .NET 4.5 installed – since reference assemblies are used for targeting versions of the framework, building an app in VS2010 and then running it is actually binary compatibility testing. To do source compatibility testing, we build against the .NET 4.5 targeting pack (which is part of the Visual Studio 11 Developer Preview).
Serialization compatibility deals with data and has several permutations. First, we let an app running on .NET 4 serialize data (e.g. save to disk) and then an app running on .NET 4.5 de-serializes (e.g. read from disk). Second, we do this in reverse by serializing from .NET 4.5 apps and de-serialize in .NET 4 apps. Third, we take a web service running on .NET 4.5 reading serialized data created by a .NET 4 based client. Fourth and last, we do the inverse with a .NET 4 web service and a .NET 4.5 client. A serialization problem will often show up as corrupted data or some kind of serialization exception.
Compatibility is an important part of migrating apps forward, though in rare cases it is necessary for a framework library to make breaking changes. We try to avoid this, using it as a last resort. MSDN documents the known breaking changes in .NET 4.5. We also have a migration guide with advice for testing your app.
If you discover any compatibility issues while working with previews and betas, we want to hear about them via Connect. Hopefully, all our work to make this a highly compatible release makes it easy for you to upgrade to .NET 4.5.
Hello Awdhes, I would like to understand issue reported by you better. It would be great if you can put me in touch with Microsoft Support professional who is handling your case. I can just talk to them and understand the issue. You can contact me on netfx45compat at Microsoft dot com.
I am not able to install .Net 4.5 in my laptop. My OS is Window 7.
Please help me?
@Rohit -- Contact us @ firstname.lastname@example.org
We have the pleasure of finding our .net4 project passed QA,. and behave inconsistently in the field with different .net combination on client machine.
Whose great idea is this "in place" upgrade? we need to isolate older release, and deal with each new ones separately.
RE: We have the pleasure of finding our .net4 project passed QA,. and behave inconsistently in the field with different .net combination on client machine.
Hello, I am from Microsoft .NET team. I would like to understand issue reported by you better. Could you contact us on netfx45compat at Microsoft dot com?
If MS really care about the compatibility, the scope must in its windows or office product business life cycle, otherwise, it will be killed. Although MS said .net 4.5 is an in-place update, still killed XP support. Each version of Visual studio will kill a older version of office development. Does anybody disagree?
Installed 4.5.1 (not by choice) on the build machine. Re-built our app. That app no longer runs on machines that do not have KB2858725 (4.5.1). This is especially bad because this app is required to run in factories that are still on XP, and 4.5.1 isn't available for XP (in spite of there being another month of support.
Note XP will be running in factories for a long, long time. I could take you places in China that are football fields sized rooms filled with machines running XP. We might not like it. But it's not an option to tell these places that XP is no longer supported. the only way to keep serving these machines is to freeze a version of VS2010 and make sure it never, ever gets updated.
@"XP No More", note that you could still build .NET 4.0 apps on your build machine with .NET 4.5.1. Just install .NET 4.0 reference assemblies on machine with .NET 4.5.1, and you could build apps for machines with .NET 4.0.
Here is link to installer for .NET 4.0 reference assemblies -> www.microsoft.com/.../details.aspx
We have a web.config that is for .Net 3.5.
When we set out App Pools to be .Net 4.0, our application breaks because it is looking for older assemblies. How can we regenerate the web.config entries so that all the assembly information references the correct version, and has the right PublicKeyToken?