How do I know I am in a debug configuration

I thought there was a property that let's me know when I am in a debug
configuration, instead of a Release Configuration.  I need it because
I want to use a test database in debug, but a real database in
release.

Is there such a property?  I tried
System.Diagnostic.debugger.IsAttached, but that seems to be something
different.
0
Dom
3/27/2010 10:35:17 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

1 Replies
720 Views

Similar Articles

[PageSpeed] 48

Dom wrote:
> I thought there was a property that let's me know when I am in a debug
> configuration, instead of a Release Configuration.  I need it because
> I want to use a test database in debug, but a real database in
> release.

I would advise against doing it that way.

> Is there such a property?  I tried
> System.Diagnostic.debugger.IsAttached, but that seems to be something
> different.

The easiest way I know of is to use "#if DEBUG" in your code to 
conditionally compile code you want in the Debug configuration.

I'm pretty sure there is some information in the assembly somewhere you 
could also look for; some kind of optimization setting is kept, that 
controls whether the JIT compiler optimizes the program at run-time. 
But I don't know specifically what that is.

That said, my previous point about not using the build configuration to 
determine what database you are using is based on the fact that you will 
need to be able to debug the configuration you expect to use when the 
program is deployed, _and_ you also want to make sure you do testing 
with the test database with the Release build configuration.

On top of all that, I don't think it's generally a good idea to 
hard-code the database reference in your program in the first place, 
which would be implied by having the database used depend on the build 
configuration.

So, instead you should make your program so that it allows the user to 
configure the database it will use, and then make sure you test all the 
combinations of build configuration and database that are relevant.

Pete
0
Peter
3/27/2010 10:46:13 PM
Reply:

Similar Artilces:

HELP! I KNOW U KNOW HOW TO DO THIS....
i was told there is a way to make certain letters equal numbers. EX. BREADNMILK is 1234567890 / B=1 R=2 and so on. This is so each product has a digit code for the price. EX. EDB = $3.51. I don't know how to do that but my boss said it's possible....THANK-YOU! I have an idea, but I'm not sure I understand what you really want, so I hate to waste the time to produce it. Could you give a few more examples? What are you doing with the data once you figure out a way to make this work? Why BREADNMILK? Is that just an example? You'll use just one word? You're trying to obscu...

OWA jumping mouse
I have two computers on my network that are having an interesting issue. When they are creating a message and typing away in the body of the message, randomly when they hit a key, any key, they system will act as if the mouse was clicked. If the mouse is over the send button, it would have sent the email. If the mouse was over the start button, the start menu would have come up. Where ever the mouse was left at, it will act as if it was clicked. It is very random but often. This only happens in OWA, not in outlook or any other place. Both systems are running XP pro SP2 with IE 6 SP2. ...

It's Conditional Formatting, Jim, but not as we know it...
Hi, Is there any way of producing the same as a conditional format on a cell (ie. chenge fill and font colours according to a calculated value) but for more than three (four, if you count the default) values? TIA Dave An example '----------------------------------------------------------------- Private Sub Worksheet_Change(ByVal Target As Range) '----------------------------------------------------------------- Const WS_RANGE As String = "H1:H10" '<=== change to suit On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Targe...

C++ VS 2005 Application works in Debug, not in Release Mode
I have a C++ application which runs in debug, though not release, mode. The application opens a dialog box, which generates an error when run in release mode. It instantiates correctly, but the OnInitDialog() method throws an error. The dialog itself is simple, it has only a progress bar and a bitmap. When I look at modules which get loaded, I see that comctl32.dl gets loaded twice, once from the Windows\System32 directory, once from the Windows\WinSxS\x86_Microsoft... directory. Could this be the problem? My code in the OnInitDialog() method now looks like this: MyDlg::OnInitDialog...

smtp debug
I have a user that has problems periodically sending email. After hitting Send/Receive, it sits there and then stops. The email remains in the Outbox. Here is a snippet from the debug log: (I have changed names) #####EXAMPLE 1 Microsoft Internet Messaging API 6.00.2800.1441 SMTP Log started at 09/16/2004 09:03:03 SMTP: 09:03:03 [db] Connecting to 'smtpserver.domain.com' on port 25. SMTP: 09:03:03 [db] srv_name = "smtpserver.domain.com" srv_addr = 123.45.67.900 SMTP: 09:03:04 [rx] 220 smtpserver.domain.com ESMTP Server (Microsoft Exchange Internet Mail Service 5.5.2657...

Do You Know???
Hi... Where to get personal / business loan? How to settle your debt? Where to invest? Monthly Profit 20%? One time investment only? Setup your own business & growing income? The Beneficiary Bank is Barclays Bank? Just only need USD1070 for Financial Freedom? 300% Profit,10%Commission,5% Bonus,1% Revenue & 0.01% Daily Profit Payout!! ---------------------------------------------------------------------------= =AD=AD----- Get me online at : E-Mail /Yahoo Messenger,my ID : sallehes[at]yahoo.com Change [at] to @ If you never take the chance, you will never have the chances. >From O...

Do you know this?
I gonna to purchase Joyfax Server. Do you have any idea about it? 'Joyfax - Fax Server, Fax software, Windows Fax Server, Network Fax Solution, Free Fax Viewer, Fax Broadcasting software' (http://www.joyfax.com) -- lenny66 Posted via http://www.vistaheads.com In article <lenny66.4cslw5@no-mx.forums.vistaheads.com>, lenny66.4cslw5 @no-mx.forums.vistaheads.com says... > What exactly would you imagine yourself seeing subject "Do you know this?" People usually ignore topics with unclear subjects. -- Poutnik The best depends on how the be...

Does any know how to add more columns in the NCAA Excel Tracker?
trying to add more columns in the NCAA Tournament Tracker but it won't keep the formulas correct. Any help Just what exactly is the/a "NCAA Tournament Tracker"? -- Regards, RD -------------------------------------------------------------------- Please keep all correspondence within the Group, so all may benefit ! -------------------------------------------------------------------- "NCAA Tourney Commissioner" <NCAA Tourney Commissioner@discussions.microsoft.com> wrote in message news:8020B969-D6D4-4857-96E4-3475D1F75DA6@microsoft.com... trying to add more ...

debug prompt "Please enter the path for vc60.pdb"
When starting up software in debug state under the environment, there always pop up dialog: (Find Symbols) Please enter the path for vc60.pdb but the vc60.pdb is in the debug directory. Unfortunately, this is the default name for the pdb file so it may be another module that it's looking for in another folder. You may want to change the name in your properties so that they each have their own name (for each component in your projects). That would make it easier to figure out which one it's really looking for at runtime. Tom "joddy" <zsy2000@citiz.net> wr...

Manufacturing Configurator
A prospect runs a printing business. They take orders from their customers. No two orders are exactly the same. They print calendars, business cards, company annual reports, menus etc. They need a solution that will allow them to cost their orders and generate quotes for their customers. If making some calendars of this size they will need this type of paper and so much bottles of ink. If they are doing another size calendar, they will need this other size paper and this many bottles of ink. I have seen some configurator modules for some manufacturing solutions. They sound as...

do you know??
hi I have a problem I had made a programm deal with database I had created it manually by microsoft access. I want the programm make the database automatically when it run on every computer?? second did every computer run this programm have microsoft access ??? goodbye thank you ??? 1. You should just ship the mdb file with your program. 2. you don't need to have access installed on all the computers just the odbc/ado drivers for access. AliR. "mohaz" <mohaz14@yahoo.com> wrote in message news:1187291340.459954.57930@k79g2000hse.googlegroups.com... > hi >...

I would like to know how to uninstall Outlook Express 6!
When I purchased my computer, it was installed with Outlook Express 6, and I don't use the program. I would like to know how to uninstall it. Please reply if you know how! If you are running Windows XP with Service Pack 1 or Windows 2000 with Service Pack 3 or 4, try going to the add/remove applet in the control panel. Choose Set Program Access and Defaults. Under the email section, uncheck the box to show the icon. (It will always remove the OE icon.) Note: If Microsoft Outlook is your default mail program, it will try to push newsgroup support to OE (started as a news only clien...

EARN $ 1,434,892.8 BY E-GOLD (GUARANTEED!!) All you need is 3 People You know #13
EARN $ 1,434,892.8 BY E-GOLD (GUARANTEED!!) All you need is 3 People You know Hello every body , im be glad to introduce one of the best MLM for every body who wants to explod his/her earning with very simple steps and incredible situation! JUST IMAGINE...... If you achieve only 10% success you will still make $ 143,489.28 If you achieve only 1% success you will still make $ 14,348.928 But If we trust to each other and be serious, reaching to $ 1,434,892.8 is not seem so far,just three or four weeks!! The whole works that you should do : 1) You should open an e-gold account ,th...

Anyone know how to setup a reverse mortgage in Lifetime Planner?
All I've managed so far is to just setup an income account based on projected figures for my home, but I don't know how to have this reflected in net value of the home. Thank you! This is a great question for the newsgroup--I don't recall it having come up before. I suspect it will come up more in the future. My basic thought is to setup a Liability Account and make the payments from the lender transfers from the liability to a cash account. The liability grows. Maybe you even add the accumulating unpaid interest to the liability account? (Since it defers for tax purposes,...

How To Know
Hi All Is there any option to know,who has open file? and Is that possible to Close also. thanks Amrit On 20/12/2009 23:51, Amrit wrote: > Hi All > Is there any option to know,who has open file? > > and Is that possible to Close also. Use Process Explorer. -- Dee Earley (dee.earley@icode.co.uk) i-Catcher Development Team iCode Systems Hi Dee I don't understand How To? "Dee Earley" <dee.earley@icode.co.uk> wrote in message news:uurKktigKHA.1824@TK2MSFTNGP04.phx.gbl... > On 20/12/2009 23:51, Amrit wrote: >> Hi...

anyone know where to set the transaction number format?
Hi, Deos anyone know where to set the transaction number format. I need to set the transaction number from 7 digit to 6 digit. regards Dennis Dennis, The Transaction number started with 1. Are you saying that you have used a million numbers already? SO Administrator | File | Connect | put in your password | Database | Set next Transaction Number -- * "Dennis" <Dennis@discussions.microsoft.com> wrote in message news:DB499B32-9A24-4090-896E-DF0644467DCC@microsoft.com... Hi, Deos anyone know where to set the transaction number format. I need to set the transaction numb...

Configuration help
Being new to the CRM world, I am struggling to get my feeble mind around some of the "simple" setup scenarios. What I am looking for in other words, are ideas on the types of services you are setting up, resource groups, queues, workflow, etc., etc.... I realize this is a very broad question as every setup is unique - but if there are some best practice type ideas/setups out there I would love to hear them. Also, if anyone can point me to some good resources on sample setups, it would be much appreciated. We are a technology sales/service company trying to implement this in...

OT: Anybody in here do much with COM? Need to know what newsgroups...
....to use to post the following question: "What is the relationship between deploying and registering a typelib for your COM components and a proxy for said components?" Thanks, WTH "WTH" <nospam@spamtheman.com> wrote in message news:e88StatPFHA.3076@tk2msftngp13.phx.gbl... > ...to use to post the following question: > > "What is the relationship between deploying and registering a typelib for > your COM components and a proxy for said components?" > > Thanks, > > WTH > > Try the microsoft.public.vc.atl newsg...

How do I know?
How do Iknow whetehr my OE installation is uptodate? If it is older...how do i get the update...to the current version seena Your message headers show it is up to date: X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 x-mimeole: Produced By Microsoft MimeOLE V6.00.2900.5579 There will never be any changes or improvements to Outlook Express as all production ceased June, 2006. There is a chance of a security update in the future if needed, but all you need to do is make sure you keep fully patched at Windows Updates. -- Bruce Hagen MS-MVP [Mai...

Going away: Need to save pic from daily email
I am going away on a conference and would like to have Outlook (2002) download my mail each day while not at home - which I know I can do. One of the emails I receive is a daily html comic email with the strip in it. Is there a way that I can automate to save the pic in a folder while away from my computer if I leave Outlook running to auto download? The pic is on this comic server and only allows a few of the comics before the present date so I can't do it when I come back 'cause then I will have missed it. Thanks ...

do you know how to....
Is there a way to use Excel to help identify like numbers from two differnt lists of numbers. These lists of numbers contain numbers that are numeric and alpha- numeric. With conditional formatting and a formula, Say list 1 is in A1:A1000, list 2 in H1:H5000 Select A1:A1000, and add a CF formula of =COUNTIF($H$1:$H$5000,A1)>0 and then H1:H5000, and add a CF formula of =COUNTIF($A$1:$A$1000,H1)>0= -- HTH RP (remove nothere from the email address if mailing direct) "dan s" <anonymous@discussions.microsoft.com> wrote in message news:10aa01c5595d$2f79a8e0$a6012...

Debug Assertion Failed #2
Hi, What is wrong with this bit of code please if(message == WM_COPYDATA) { WmCpyDta_SetEncrypt('d'); WmCpyDta_SetMessageId(WmCpyDta_BaseDefaultMsgId()); CString strTag, strData; WmCpyDta_SendMessage_TI_SetCountMsg(NULL, NULL, lParam, strTag.GetBuffer(0), strData.GetBuffer(0)); m_ctrlAddress.SetWindowText(strData); m_ctrlCount.SetWindowText(strTag); strData.ReleaseBuffer(); strTag.ReleaseBuffer(); } I get a Debug Assertion Failed error with the expression line as nLength <= GetData()->nAllocLength ...

Update crashes Access except in debug
Running Access 2003 on XP, doing a select from a table and passing the results to this subroutine to update another table. When running in debug mode, it works. When I stop it an anaylze the update statement, copy and paste into a new query, it works. Running without debug turned on, Access crashes (on three different installations of Access). What I know to be true: 1. the input record set contains records, all fields are non-null 2. the datatypes are correct 3. it crashes on the first record Any clues? ---- Sub UpdLicenseGrantedOutput(rstOutput As Recordset) Dim SQL_Up...

Auto Complete list has been deleted somehow anyone know how to fix??
I have hundreds of emails in auto complete and today when I tried to use it they were all gone. This happened to me about 3 years ago and I never was able to find out why. Can anyone help me please.. Submitted using http://www.outlookforums.com mike long wrote: > I have hundreds of emails in auto complete and today when I tried to ... <gatewayed post was truncated to illustrate lack of proper line wrap> The autocomplete cache is in the nickname file (.nk2). Do you still have a ..nk2 file? If it is gone or corrupted, restore it from your backups. http://support.mi...

Configure Server 2008 to join SBS 2003 Domain
Client has an exisiting 2003 SBS Domain. They purchased Server 2008 Ent Edition and that will be setup and configured with a software application and users before it is sent to the site that has the 2003 SBS. 10 machines are also being configured to connect to the 2008 Server before the server and computers are sent to the 2003 SBS location. Can the 2008 server be setup as a domain before it is shipped and then moved to the SBS 2003 domain once it gets there? -- Pat In a word, no. You can't join a computer to a domain without connecting to the domain. And any users you a...