Re: If 1 = 0 Then .... Serious bug in .NET?!

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



From the sounds of your "fix", I would guess that the internal symbol tables
got corrupted. A "Clean Solution" would have also fixed this. I use both VB and C# and have found that VS can get confused and the only way to deconfuse it is to clean the project and then do a Rebuild All.

Also, turn Option Strict On and Option Compare On as VB defaults as well as ensuring these two lines are the first lines to appear in all your VB source files. As I previously stated, the bug you ran into is actually a flaw in VB itself when Option Strict is not being enforced.

Mike.


"Stephany Young" <noone@localhost> wrote in message news:uK$hXjwOIHA.4740@xxxxxxxxxxxxxxxxxxxxxxx
From the 'sound' of your 'fix' it was due to some form of corruption of one or more of your source-code files.

In such a case I would be reticent about pointing the finger at VS as the cause could have been among a myriad of things.

If you do, however, manage to positively identify the cause of such corruption, I suggest that you rush out and buy lots of lottery tickets as you will be one lucky bunny :)


"Eivind Gussiås Løkseth" <eloekset@xxxxxxx> wrote in message news:12DC2FF9-8EA2-4F5B-94B8-1D20B53F2BA2@xxxxxxxxxxxxxxxx
Hi!

I'm sorry that I didn't mention which language I used. The title of the thread shows it's VB. It was in .NET 2.0. In the first post, I attached a screenshot of the code being debugged. It showed a quickwatch of the property value, which was 1. That this value was compared to 0. And that the debugger had passed that If-test as if it was True.

First of all, I can't understand how it possible that 1 = 0 can be True. I thought it had to be a deviation between the source code and the compiled assemblies. But that should have been fixed after I did a clean and rebuild of the whole solution. The error was still there.

So after I deleted all content in my local workspace, retrieved everything from Team System and compiled again, the error was gone. So I guess this must have been a Visual Studio / Team System bug, rather than a .NET Framework bug. What you see, is *not* what you've got. :)



"Scott M." <smar@xxxxxxxxxxxxx> wrote in message news:%23GzCYsgOIHA.4712@xxxxxxxxxxxxxxxxxxxxxxx
I assume you are referring to C#.

In C# a single equal sign (=) refers to assignment, as in: x = 7;

But double equal signs (==) refer to comparison, as in: if(x==7)

The reason that if(x=7) returns true is because x = 7 is an expression that is carried out without error (assign the value of 7 to the variable x).

-Scott

"bob1at7shore" <bob1at7shore@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:96A7DEC8-D022-4122-BD04-0E71C6124194@xxxxxxxxxxxxxxxx
if (1=0) or if (1==0)
?????
Just want to be clear.


"Eivind Gussiås Løkseth" wrote:

Today I noticed something I thought was impossible. I have a piece of code
that is equal to If 1 = 0 Then. The unbeliavable thing is that this
expression is True! (See the attched image.)

When I noticed it, I got one of my collegues to have a look at it, as I
started to think there was something wrong with my eyes. We both saw the
same thing on my machine, and went to his machine to debug the same piece of
code there. On his machine everything worked as expected.

I then restarted my computer, cleaned and then rebuilt the whole solution,
but the error was still there! The next natural thing to do before bying a
new computer, is to delete all source code in the local workspace, and then
get all the latest source from TFS again. That actually fixed my problem.
But I still wonder how this can be possible.









.



Relevant Pages

  • Re: Writing a unittest against thread (un)safe ref-counter pointer
    ... frustrations before the bug was discovered. ... If your memory is clean afterwards and the program did not crash it is likely that your reference counter is clean. ... I have not found anything better than experience and much care for now to avoid synchronization issues in core libraries of mutli-threaded applications. ...
    (comp.programming.threads)
  • Re: 2.6.19 file content corruption on ext3
    ... Now I'm not exactly sure how ext3 filesystems make use ... never going to clean the page in the general case _anyway_. ... buffers being clean actually say something. ... Trying to mix it in just caused a bug that _everybody_ agrees is a bug. ...
    (Linux-Kernel)
  • Re: [PATCH] kbuild: Disallow GCC 4.1.0 / 4.1.1
    ... but still not clean enough. ... Subject: kbuild: Disallow GCC 4.1.0 / 4.1.1 ... GCC 4.1.0 and 4.1.1 has a bug that can miscompile __weak symbols, ... not allow these compilers (which are quite rare these days, ...
    (Linux-Kernel)
  • Re: Preempt-RT patch for 2.6.25
    ... to fix it up - in general it's much easier to fix a bug than to talk ... how significant a bug is. ... clean up the mess" stance, combined with an aggressive, uncompromising, ... demanding tone towards the maintainers of a project wont get you very ...
    (Linux-Kernel)
  • Re: Geronimo!
    ... slrn newsreader v0.9.9p1:http://slrn.sourceforge.net/ ... cleans up the Corruption of Tim and Gallifrey. ... Hey! ... What we need is a John Long-esque troll-killer to clean up the ...
    (rec.arts.drwho)