为什么在.NET中分发Debug版本的应用程序是不好的做法? [英] Why is a bad practice to distribute the Debug version of the application in .NET?

查看:118
本文介绍了为什么在.NET中分发Debug版本的应用程序是不好的做法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读这个问题,在第一个评论中,@Cody Gray说:

Reading this question, in the first comment, @Cody Gray says:


呃,你知道你不应该
重新分配Debug版本,
对吗?

Erm, you know that you're not supposed to redistribute the "Debug" version, right?

我很关心关于它。在Visual Studio中,我通常在调试模式下开发我的应用程序,如果我需要分发可执行文件,那么我所做的就是压缩 .exe ,需要 .dll 文件(在 bin \Debug 文件夹中)。

I'm concerned about it. In Visual Studio, I usually develop my applications in Debug mode, and if I need to distribute the executable, all I do is zip the .exe and required .dll files (in bin\Debug folder).

为什么这是一个坏主意?

Why is it a bad idea?

在发布模式下,做这个和完成等效的事情有什么区别?

What is the difference between doing this and doing exactly the equivalent thing in Release mode?

编辑:

我之前提到这个问题,但我只是想修改它来增加差异:


I asked this question time ago, but I just wanted to edit it to add a difference:

当在代码中使用 Debug.Assert 来测试它,并在发布模式中编译时,所有这些行都已经消失了,所以这可能是另一个区别。

When using Debug.Assert in the code to test it, and compile in Release Mode, all those lines are gone, so that could be another difference.

推荐答案

这取决于你用来开发程序的是什么语言。当您使用C ++时,您将获得/ RTC和Edit + Continue支持的开销。他们减少生成的代码很多,并使您的应用程序可能早期在StackOverflow崩溃如果您使用递归。您可以从检查代码获取的运行时异常可能难以在没有调试器的情况下进行诊断。

It depends on what kind of language you use to develop your program. When you use C++, you get the overhead of /RTC and the Edit + Continue support. They slow down the generated code by a great deal and make it likely your app crashes early on a StackOverflow if you use recursion. The runtime exceptions you can get from the checking code can be hard to diagnose without a debugger.

如果您使用VB.NET,那么您将很容易有一个可拔出的内存泄漏当您使用Debug构建而不使用调试器。其编辑+继续支持代码中的缺陷导致对包含WithEvents事件的类的每个实例泄漏WeakReference。您的应用程序最终会在OutOfMemory异常中死亡。

If you use VB.NET then you'll easily have a unpluggable memory leak when you use the Debug build without a debugger. A flaw in its Edit + Continue support code causes a WeakReference to be leaked for every instance of a class that contains a WithEvents event. Your app eventually dies on an OutOfMemory exception.

如果您使用C#,那么heckofalot不会出错,JIT编译器就被阻止生成优化的机器代码和垃圾回收没有效率。你的程序运行缓慢,消耗更多的内存比必要。这也适用于VB.NET和C ++ / CLI。

If you use C# then not a heckofalot goes wrong, the JIT compiler is just prevented from generating optimized machine code and garbage collection isn't as efficient. Your program will run slow and consume more memory than necessary. This applies to VB.NET and C++/CLI as well.

在编写代码时,Perf通常是程序员的头脑。因此,运送调试版本有点亵渎。然而,I / O,磁盘,网卡或dbase服务器通常会严重限制大量程序。在这种情况下,原始的cpu perf并不重要。

Perf is usually foremost on a programmer's mind when writing code. As such, shipping the debug build is a bit blasphemous. A significant number of programs are however completely throttled by I/O, the disk, network card or the dbase server typically. Raw cpu perf doesn't matter a great deal in that case.

这篇关于为什么在.NET中分发Debug版本的应用程序是不好的做法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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