473,372 Members | 821 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,372 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 3348
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, Gran 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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.