Re: Debug Vs Release
From: Alvin Bruney [MVP] (vapor)
Date: 02/11/05
- Next message: Roy: "Re: OnButtonClick make an individual cell visible/invisible?"
- Previous message: cs_hart_at_yahoo.com: "transport error when"
- Maybe in reply to: Srinivasa Rao: "Debug Vs Release"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 11 Feb 2005 12:23:30 -0500
I didn't say you were wrong. I said that I was referring to the source code
which is what the OP is referring to and not the IL code or the compiled
assembly.
> I have selected "Release" in the solution cofiguartions dropdown list
> and compiled the application. The statement " Debug.Assert(intcount = 3,
> "Yes
> it 3.") " is not removed from the code.
> Unfortunately, I was referring to the source code integrity, not
> the IL code.
-- Regards, Alvin Bruney [MVP ASP.NET] [Shameless Author plug] The Microsoft Office Web Components Black Book with .NET Now Available @ http://www.lulu.com/owc ---------------------------------------------------------- "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:OTXdXgFEFHA.4052@TK2MSFTNGP09.phx.gbl... > If I compile that code in debug mode then dissassemble the EXE, I get: > [STAThread] > private static void Main(string[] args) > { > Debug.Assert(args != null); > } > > > > if I compile it in release mode than dissassemble the EXE, I get: > > [STAThread] > private static void Main(string[] args) > { > } > > or the IL for it: > DEBUG: > .method private hidebysig static void Main(string[] args) cil managed > { > .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() > .entrypoint > // Code Size: 13 byte(s) > .maxstack 2 > L_0000: ldarg.0 > L_0001: ldnull > L_0002: ceq > L_0004: ldc.i4.0 > L_0005: ceq > L_0007: call void [System]System.Diagnostics.Debug::Assert(bool) > L_000c: ret > } > > > > > RELEASE: > .method private hidebysig static void Main(string[] args) cil managed > { > .custom instance void [mscorlib]System.STAThreadAttribute::.ctor() > .entrypoint > // Code Size: 1 byte(s) > .maxstack 0 > L_0000: ret > } > > > It should be noted that this is the default bahaviour in VS.Net...if you > are > using the command line compiler, or another one, the behaviour might be > different.This is based on the DEBUG compilation flag. You can find out > more about this at: > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdiagnosticsdebugclasstopic.asp > > Karl > > -- > MY ASP.Net tutorials > http://www.openmymind.net/ > > > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message > news:%23N6kDTFEFHA.1292@TK2MSFTNGP10.phx.gbl... >> Test it for yourself then. Build this in debug and compare the results to >> release mode. On my system, the debug line is still in there. >> >> [STAThread] >> >> static void Main(string[] args) >> >> { >> >> System.Diagnostics.Debug.Assert(args != null); >> >> } >> >> >> You will find that the major difference between debug and release is that >> optimization is turned on and debug symbols are not emitted. Most of this >> optimization is done by the JITTER and not the language compiler so had > you >> prefaced your comment to specifiy the Jitted code you would have been >> correct. Unfortunately, I was referring to the source code integrity, not >> the IL code. >> >> -- >> Regards, >> Alvin Bruney [MVP ASP.NET] >> >> [Shameless Author plug] >> The Microsoft Office Web Components Black Book with .NET >> Now Available @ http://www.lulu.com/owc >> ---------------------------------------------------------- >> >> >> "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> >> wrote in message news:etw8KgEEFHA.1188@tk2msftngp13.phx.gbl... >> > Alvin: >> > I'm pretty sure this is incorrect. Release mode will renove all >> > statements >> > from the System.Diagnostic.Debug class >> > >> > Karl >> > -- >> > MY ASP.Net tutorials >> > http://www.openmymind.net/ >> > >> > >> > "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message >> > news:%23R3%233QDEFHA.4004@tk2msftngp13.phx.gbl... >> >> Release mode does not remove statements, it simply does not provide a >> >> programming debugging database file. (well it does some other stuff as >> >> well). The major difference is that you will not be able to attach the >> >> debugger in release mode because of the absence of that file. The >> >> compiler >> >> does maintain the integrity and structure of your code, so the >> > debug.assert >> >> will still be there. >> >> >> >> -- >> >> Regards, >> >> Alvin Bruney [MVP ASP.NET] >> >> >> >> [Shameless Author plug] >> >> The Microsoft Office Web Components Black Book with .NET >> >> Now Available @ http://www.lulu.com/owc >> >> ---------------------------------------------------------- >> >> >> >> >> >> "Srinivasa Rao" <SrinivasaRao@discussions.microsoft.com> wrote in > message >> >> news:CF7BE016-1E97-42BA-B3A7-4155E236B920@microsoft.com... >> >> >I have read in one article that when we compile the application in >> > release >> >> > mode, all the debug classes and properties will be automatically >> >> > removed >> >> > from >> >> > the code. I tried to implement this thing by using the following >> >> > code >> >> > in >> >> > Page_Load event handler. >> >> > >> >> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As >> >> > System.EventArgs) Handles MyBase.Load >> >> > Dim intcount As Integer >> >> > intcount = 0 >> >> > For intcount = 0 To 4 >> >> > Response.Write(intcount) >> >> > Debug.Assert(intcount = 3, "Yes it is 3.") >> >> > Next >> >> > End Sub >> >> > >> >> > I have selected "Release" in the solution cofiguartions dropdown >> >> > list >> > and >> >> > compiled the application. The statement " Debug.Assert(intcount = 3, >> > "Yes >> >> > it >> >> > is 3.") " is not removed from the code. I have closed the solution > and >> >> > opened >> >> > the solution. Even then also the statement is not removed. What we > have >> > to >> >> > do >> >> > if the statement has to be removed automatically? >> >> > >> >> > Any help most welcome. >> >> > >> >> > Regards >> >> > G.V.Srinivasa Rao. >> >> >> >> >> > >> > >> >> > >
- Next message: Roy: "Re: OnButtonClick make an individual cell visible/invisible?"
- Previous message: cs_hart_at_yahoo.com: "transport error when"
- Maybe in reply to: Srinivasa Rao: "Debug Vs Release"
- Messages sorted by: [ date ] [ thread ]