473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Compiling for Production: Release vs. Debug

We have developed a number of different applications (ASP.NET web site,
Windows services, DLLs, Windows forms, etc.) in C# 2.0. We have developed
and unit tested all these applications/components using Debug mode. Now we
are ready to compile everything for release to production. However, we don’t
know whether we should compile all the applications/components/assemblies
using Release mode (or keep everything in Debug mode).

We’ve tried researching Debug mode vs. Release mode but have been unable to
find any concrete information on which one is better, which one should be
used in production and why, if Debug in production is good or bad, etc.

So, we’re posting the question(s) here:

- Should we compile in Release mode for a production release and why?
- Are there any issues releasing Debug mode applications/assemblies into
production?
- What (if any) are the main differences between Release and Debug modes?

Thanks.

Jul 14 '08 #1
3 3349
lmttag wrote:
We have developed a number of different applications (ASP.NET web site,
Windows services, DLLs, Windows forms, etc.) in C# 2.0. We have developed
and unit tested all these applications/components using Debug mode. Now we
are ready to compile everything for release to production. However, we don’t
know whether we should compile all the applications/components/assemblies
using Release mode (or keep everything in Debug mode).
Release. Debug gains you nothing unless you actually plan on debugging the
application in the field, which is rare. What debugging does, mainly, is
turn off most aggressive optimizations (like eliminating local variables,
extracting loop invariants and other things that make your code run faster
but weaken the connection between the binary and the source). It may insert
extra information to allow for edit-and-continue sessions. Some constructs
like P/Invoke and dynamic code generation may deliberately use slower but
more predictable implementations to help you detect problems (this may just
be restricted to when you're actually running the code under a debugger,
though, I'm not certain). None of this helps your customer much, and the
code may run slower.

For managed code, the differences between debug and release code tend to be
less dramatic than for unmanaged code, mainly because it's all JIT-compiled
bytecode anyway. That said, you may experience rare cases where a debug
build doesn't have a problem experienced by a release build (and vice versa)
due to initialization or timing issues. These usually indicate a subtle bug
that's simply doesn't manifest under certain conditions. You should always
perform any tests on the release version as well, as a sanity check.
Nothing's more embarrassing than having to say "but it worked on my machine".

A debug build is ideal for quickly diagnosing and fixing problems, but you
can still debug a release build if necessary, and it's important to be able
to replicate your customer's situation. What you should always do is have
the compiler produce debugging symbols (.PDB) for your application, even in
release mode. In Visual Studio, producing these is controlled by the options
onder project properties -Build -Advanced.

These symbols are not for distribution to your customer (unless you don't
mind them seeing your source file names and line numbers...) but they will
help you in debugging an issue on the same binary the customer has, should
this turn out to be necessary.

--
J.
Jul 14 '08 #2
lmttag wrote:
We have developed a number of different applications (ASP.NET web site,
Windows services, DLLs, Windows forms, etc.) in C# 2.0. We have developed
and unit tested all these applications/components using Debug mode. Now we
are ready to compile everything for release to production. However, we don’t
know whether we should compile all the applications/components/assemblies
using Release mode (or keep everything in Debug mode).

We’ve tried researching Debug mode vs. Release mode but have been unable to
find any concrete information on which one is better, which one should be
used in production and why, if Debug in production is good or bad, etc.

So, we’re posting the question(s) here:

- Should we compile in Release mode for a production release and why?
- Are there any issues releasing Debug mode applications/assemblies into
production?
- What (if any) are the main differences between Release and Debug modes?
Other has already replied to your questions.

Better that I could have done.

But I just want to note one thing: if you put release versions in
production, then remember to have QA test release versions and
not debug versions !

Arne
Jul 15 '08 #3
On Jul 15, 12:55*am, Göran Andersson <gu...@guffa.comwrote:

<snip>
Throwing exceptions is MUCH slower in debug mode.
Well, throwing exceptions is much slower *when there is a debugger
attached*. A very quick test I've just run (basically the code at
http://pobox.com/~skeet/csharp/exceptions.html) performed about the
same with flags "/o+ /debug-" as with "/o- /debug+".

Jon
Jul 15 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chad Slagle via DotNetMonster.com | last post by:
in "c:\Root.Aspects.Exceptions\example.vb(20)" I receive an: error BC30456 'Insrumentation' is not a member of 'Aspects. In the Solution the following projects exist: Root.Aspects.Exceptions...
4
by: Benne Smith | last post by:
In our company, i have three servers; 1) a development server (mine only - here i make daily changes and test my stuff) 2) a test server (for the users to test milestone builds - changes weekly)...
4
by: Jazz | last post by:
Hello, I have a question about trace as MSDN seems confuses me.(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDiagnosticsTraceClassTopic.asp). My answer...
1
by: Magne Ryholt | last post by:
Using VS.net 2003 (C#) Code: : #if DEBUG something #else something else #endif
10
by: Scott | last post by:
I have a simple asp.net app which works fine in debug mode, but crashes on the following line when I run it on the production server: Dim dt As DataTable I have tried the following variations...
3
by: Haldun ALIML | last post by:
Suppose that you have below property in some class, #if DEBUG public string DebugInfo { get { return "INDEX : " + _name + "\n" + "Index Owner : " + _owner.Name + "\n" + "Index Column Count:...
9
by: Q. John Chen | last post by:
It is great to have an automated testing during development. BUT, How can I build the production release without nunit being included? THX. John p.s. I posted this in nunit group but...
3
by: O.B. | last post by:
In .NET 2005, I have a C# GUI project that is dependent on a C# DLL project. When I compile the GUI project in Release mode, it copies the "debug" version of the DLL into the bin directory of the...
2
by: JimLad | last post by:
Hi, First of all - sorry for this question but there's a load of confusing stuff online. This is really just a clarification. When 'Publish'ing the production version of an ASP.NET 2.0 web...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.