Welcome Guest.   Make a donation to an author on the site April 20, 2014, 06:30:40 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Learn about the DonationCoder.com microdonation system (DonationCredits).
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: Prev 1 [2]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: C# & Visual Studio Problem  (Read 4189 times)
mwb1100
Supporting Member
**
Posts: 1,227


View Profile Give some DonationCredits to this forum member
« Reply #25 on: January 16, 2011, 11:37:55 AM »

So, just to be clear, the *program* works fine if you have a constant `false` controlling the `if` - the problem is that the debugger is unable to deal correctly with variables scoped to the `else` clause.  Is that a fair summary?
Logged
kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 2,975



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #26 on: January 16, 2011, 02:41:52 PM »

Quote
WTF? It's normal again...

Has anyone heard of this kind of wonkiness before?

Yes, I have.  Per discussion with a tech of MSDN, it's a bug in the Debugger.
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

Renegade
Charter Member
***
Posts: 10,362



Tell me something you don't know...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #27 on: January 16, 2011, 04:41:55 PM »

So, just to be clear, the *program* works fine if you have a constant `false` controlling the `if` - the problem is that the debugger is unable to deal correctly with variables scoped to the `else` clause.  Is that a fair summary?

Yes.

"if (false)" results in locally scoped variables declared in else clauses not being available to the debugger, but still functioning properly in the software.

Here's something you can copy & paste in VS to have a quick look:
Formatted for C# with the GeSHI Syntax Highlighter [copy or print]
  1. string test1a = "Hello";
  2. int test2a = 4;
  3. string test1c;
  4. int test2c;
  5. if (false)
  6. {
  7. }
  8. else
  9. {
  10.    string test1b = test1a + " world!"; // can't see 1b
  11.    int test2b = test2a * test2a; // can't see 2b
  12.    test1c = test1b; // can see 1c, not 1b
  13.    test2c = test2b; // can see 2c, not 2b
  14.    Console.WriteLine("Break here :" + test1b + test2b.ToString()); // this works as expected, but can't see during debugging
  15. }
Logged

Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker
Pages: Prev 1 [2]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.036s | Server load: 0.01 ]