Scott Hanselman

Debug vs. Release - The Best of Both Worlds

February 13, 2004 Comment on this post [4] Posted in ASP.NET | Bugs
Sponsored By

Mark Pearce posted in the comments about my Debug vs. Release post some valuable tips that deserved being shared in a formal post.   Mark reminds us of the little-known little-used [.NET Framework Debugging Control] section of a {gasp} .INI file.  These help guide and control the JIT.  From MSDN:

This JIT configuration has two aspects:

  • You can request the JIT-compiler to generate tracking information. This makes it possible for the debugger to match up a chain of MSIL with its machine code counterpart, and to track where local variables and function arguments are stored.
  • You can request the JIT-compiler to not optimize the resulting machine code.

So Mark suggested this (emphasis mine):

You can have the best of both worlds with a rather neat trick. The major differences between the default debug build and default release build are that when doing a default release build, optimization is turned on and debug symbols are not emitted. So:

Step 1: Change your release config to emit debug symbols. This has virtually no effect on the performance of your app, and is very useful if (when?) you need to debug a release build of your app.

Step 2: Compile using your new release build config, i.e. *with* debug symbols and *with* optimization. Note that 99% of code optimization is done by the JIT compiler, not the language compiler, so read on...

Step 3: Create a text file in your app's folder called xxxx.ini (or dll or whatever), where xxxx is the name of your executable. This text file should initially look like:

[.NET Framework Debugging Control]
GenerateTrackingInfo=0
AllowOptimize=1

Step 4: With these settings, your app runs at full speed. When you want to debug your app by turning on debug tracking and possibly turning off (CIL) code optimization, just use the following settings:

[.NET Framework Debugging Control]
GenerateTrackingInfo=1
AllowOptimize=0

Great stuff Mark!  I'm going to go see how this would work with ASP.NET (do I use an ASPNET_WP.EXE.ini(?) and I'll probably have to recycle the ASP.NET worker process.) 

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

A busy day indeed...let's start with the burning flesh...

February 13, 2004 Comment on this post [7] Posted in Musings
Sponsored By

This was an eventful day indeed.  Yesterday I had worn glasses for over 23 years and had vision of -9.25 diopters (roughtly 20/1600 for me).  Basically I couldn't see there was an big "E" on the eye chart until I was about 9 inches from it.  So, after 10 years of research and 5 years of waiting for the right kinds of technology I had LASIK on both eyes over lunch yesterday.

Pretty damned good.  I'm at LEAST 20/25 in both eyes only 19 hours later.  They measured me as ~20/25 this morning.  I think I'm 20/20 in the right eye and 20/25 in the left, but there's still healing to be had.  I was zapped in Oregon by Dr. Teplick who is just about the coolest guy ever.  Seriously, I did a crapload of research into this (considering I'm diabetic, and diabetics have eye problems) and I didn't want to screw around with any beginners.  As far as I'm concerned, he's the only guy to talk to.  If you are thinking about it, check them out and tell them I sent you.

Right now I'm writing this without my glasses, which is a miracle.  I figure I'll be 90% by the end of the week and 100% in a month.  But, considering it was done yesterday over lunch and I worked a full day today is pretty cool. 

Software:

As a computer-type, I have to comment on a few technical things that were interesting to me.

The WaveFront LASIK Eye mapper takes a topographical map of the eye (3-D) to deal with things like astigmatism and odd curvetures and such better than previous technologies.  I had 3 of these by two different doctors, both at Teplick and at my own Eye Doctor's.  Interestingly enough, while it looked like a clever and impressive piece of hardware, something about the title bars smacked wrong with me.  I looked closer (and dinked with it when noone was looking) and dammit if the thing wasn't running Windows 98.  Good thing Microsoft extended support past the time I had my surgery! ;)  A closer look at some other machines by my [also Lasik'ed] boss, Chris Brooks, showed that it was running OS/2.  Seems to me there's some work and sales to be made in the Windows XP Embedded space, no?

Burning:

You know what Lasik's dirty little secret is?  While the operation doesn't hurt at all (eye drops dull the pain) about 3 hours after the operation is hurts like a bastard.  Someone described it as like hot sand poured in your eyes.  I wouldn't disagree.  It was a migraine, a stick in your eye and a sinus headache all at the same time.  Now, mind you I'm not a fan of drugs, so to their credit they DID give me a prescription for Percocet.  I wanted to avoid using any narcotics if possible.  Long story short, it's not possible. :)

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

DevDays - False advertising...

February 12, 2004 Comment on this post [3] Posted in ASP.NET | Bugs
Sponsored By

What the heck?

Hey, wait a minute - that's not Scott....

That's Scott, there. (Sorry for hammering your bandwidth :).

Isn't that false advertising or something? [Tim Marman]

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Should one go to Production with a DEBUG Build?

February 11, 2004 Comment on this post [15] Posted in ASP.NET | Bugs
Sponsored By

Here's a question that I'd really like to stir up some talk/comments/feedback. 

Should one go live with a .NET (in this case ASP.NET) app compiled as DEBUG?  Some folks have claimed that whatever speed you might gain is pale compared to the usefulness of the occasional late night production debugging session.  A RELEASE build strips out Debug.Write calls, etc., but we use Log4net exclusively, so that doesn't affect us.

Thoughts and comments, oh wise bloggers?  Is this clever, controversial, or stupid?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Nine Reasons Not to Use "int" in .NET

February 11, 2004 Comment on this post [2] Posted in Programming
Sponsored By

It's official, 'int' considered harmful.  Nine Reasons Not to Use "int" in .NET

:)

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.