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

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

问题描述

我们有一个面向 .Net Framework 4.0 的 Windows 窗体应用程序.安装 .Net Framework 4.5 后,应用程序开始崩溃.我们将不得不调查崩溃,我们很可能不得不解决我们这边的问题.但是,在我们准备好使用 .Net 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?

2012 年 7 月 12 日更新:我们发现了导致我们的应用程序崩溃的重大更改:给定一个 System.Threading.Timer,当使用已关闭的句柄调用 Dispose(WaitHandle) 时,Timer 会尝试向引发异常的 WaitHandle 发出信号.Timer 的 .Net 4.0 实现可以容忍这一点,但 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...

推荐答案

但是,在我们准备好使用 .Net 4.5 之前,是否可以打开一个设置来保持旧行为?

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

没有..NET 4.5 是 .NET 4 的就地替代品.安装它后,您实际上是在新框架上运行.

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.

不幸的是,如果您想支持在安装了 4.5 和未安装 4.5 的机器上运行,这将意味着您(和其他所有人)需要在这两个框架上测试和修复问题.幸运的是,重大更改通常都是不寻常的边缘情况,因此在大多数情况下不太可能影响大多数用户.

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.5,如何保持 .Net 4.0 的行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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