如何保持.NET 4.0中的行为,如果是安装了.NET 4.5? [英] How to keep .Net 4.0 behavior if .Net 4.5 is installed?

查看:164
本文介绍了如何保持.NET 4.0中的行为,如果是安装了.NET 4.5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Windows窗体应用程序面向.NET Framework 4.0中。安装.Net框架4.5后,应用程序开始崩溃。我们必须要调查的崩溃,我们将最有可能不得不固定在我们身边的事情。但是,有没有我们可以打开,以保持旧的行为,直到我们准备使用的.Net 4.5的设置?


更新2012年7月12号: 我们发现了重大更改,导致我们的应用程序崩溃:给定一个System.Threading.Timer,与已经关闭的句柄调用Dispose(WaitHandle的)时,则计时器试图信号,抛出一个异常的WaitHandle的。在.NET 4.0实现定时器的是宽容的,但4.5是没有的。

没有站在我们这一边的错误;我们没有任何的理由,给它一个封闭的手柄,使我们就解决这个问题......直到我们找到另一个bug ......

解决方案
  

但是,有没有我们可以打开,以保持旧的行为,直到我们准备使用的.Net 4.5的设置?

没有。 .NET 4.5是就地更换.NET 4,当你安装它,你能有效地将新的框架运行。

在一般情况下,它应该是完全向后兼容,但也有一个几个重大更改

不幸的是,这将意味着你(和其他人)将需要测试并修复这两个框架的问题,如果你想支持4.5安装和没有安装4.5的机器上运行。幸运的是,重大更改通常都非同一般,边缘情况,所以它不可能影响大多数用户在大多数情况下。

We have a Windows Form application that targets .Net Framework 4.0. After installing .Net Framework 4.5, the application starts crashing. We'll have to investigate the crashes and we'll most probably have to fix things on our side. But is there a setting we can turn on to keep the old behavior until we are ready to use .Net 4.5?


Update 07/12/2012: We found the breaking change that causes our application to crash: Given a System.Threading.Timer, when calling Dispose(WaitHandle) with an handle that has already been closed, then the Timer tries to signal the WaitHandle which throws an exception. The .Net 4.0 implementation of Timer was tolerant to that but 4.5 is not.

There is a bug on our side; we don't have any good reason to give it a closed handle so we'll just fix that...until we find another bug...

解决方案

But is there a setting we can turn on to keep the old behavior until we are ready to use .Net 4.5?

No. .NET 4.5 is an in-place replacement of .NET 4. When you install it, you're effectively running on the new framework.

In general, it should be completely backwards compatible, but there are a few breaking changes.

Unfortunately, this is going to mean that you (and everyone else) will need to test and fix problems on both frameworks if you want to support running on a machine with 4.5 installed and without 4.5 installed. Luckily, the breaking changes are typically all unusual, edge cases, so it's unlikely to impact most users in most scenarios.

这篇关于如何保持.NET 4.0中的行为,如果是安装了.NET 4.5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆