How to use debug / release mode in Visual Studio?

I usually test my code locally on my work machine, and then go into the development environment and then into the production environment. What is the best way to use debug / release mode for this scenario? Do I only need to take care of debug mode in my machine? Should I publish debug mode or release mode for development? I know, I probably should publish using the release mode for production. I actually did not pay attention to all this before, so I constantly work only in debug mode, and I know that I should not.

Edit: Thanks for the answers. It seems nice to use debug mode only on my machine. Despite the fact that he is in the development of the machine, he mainly releases to the public (colleagues, qa), so he should be in release mode. And, of course, this should be the release mode when the product is released.

+6
build-process visual-studio
source share
4 answers

When releasing / publishing an application, you must do this in Release mode. Unlock mode is designed for this, freeing up applications. Generated code is usually more efficient, and many remove many of the checks that are more related to the application development phase.

On a typical day, you should develop in debug mode. Most languages ​​insert additional checks into the debug mode application. These spots are more bugs, but tend to slow down the application.

However, you must also perform strong release mode testing as part of the development process. In fact, clients will see the version version of your Release mode, and this can lead to errors being set in debug / release mode. Error checks inserted in debug mode can create side effects that hide real errors in your application.

+12
source share

I follow this approach:

  • code / debug loop on my workstation: DEBUG
  • tests on my workstation: DEBUG
  • profiling on my workstation: RELEASE
  • nightly builds and automated tests: RELEASE (performs an unattended installation)
  • QA team practice testing: RELEASE

All tests should be carried out, at least in the release build, because that is what you are going to send. Profiling debug builds is usually pretty pointless (especially in C ++) because debugging heaps have a lot of extra validation that completely changes the performance profile of a typical application.

+6
source share

In general, ALWAYS is rolling out assembly production for production. Debugging will add build weight to your weight and degrade performance.

If you are developing ASP.NET applications, leaving Debug mode in fact, change how / when your pages are compiled by the JIT compiler and significantly degrade performance to add better interactive debugging capabilities.

As for the build for deployment in development ... if you are doing unit tests against development, it would probably be nice to deploy the Debug assembly so that you can get the most debugging information when tests fail or exceptions. Nevertheless, there is, I hope, an additional testing or pre-production environment in which you can conduct your integration tests, and manual tests are carried out there. This test environment / Pre -Prod should DEFINITELY use release builds so that you can see the true performance and compilation issues before moving on to Production.

If you do not have this intermediate level of Testing / Pre-Prod, I would suggest starting the Dev environment with Release. In other words, you must run at least one level before releasing the Release configuration.

For more information on what you can do with configurations, I have a blog post specifically for Silverlight ( http://blog.tonyheupel.com/2009/04/environment-specific-service-references.html ). It has a link to Scott Hanselman for a more general article on build configurations and different environments.

+3
source share

By default, the release build will be compiled with the more optimizer switches turned on, which will result in a faster and smaller code that you usually want to release for clients (hence the name). T

it debugs the assembly with little or no optimization, which means that when using the debugger, the basic machine code more closely matches the source code, which helps with debugging. In addition, the debugging collection by default inserts additional runtime code checks that will catch common errors, such as access to uninitialized elements of the array.

Please note that you can create release assemblies using debugging symbols, it becomes more difficult for the debugger to match the current instruction in machine code with the corresponding source line.

+2
source share

All Articles