Re: If 1 = 0 Then .... Serious bug in .NET?!
- From: "Michael D. Ober" <obermd.@.alum.mit.edu.nospam>
- Date: Mon, 10 Dec 2007 05:53:37 -0700
From the sounds of your "fix", I would guess that the internal symbol tablesgot 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@xxxxxxxxxxxxxxxxHi!
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@xxxxxxxxxxxxxxxxxxxxxxxI 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@xxxxxxxxxxxxxxxxif (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.
.
- References:
- Re: If 1 = 0 Then .... Serious bug in .NET?!
- From: Scott M.
- Re: If 1 = 0 Then .... Serious bug in .NET?!
- From: Eivind Gussiås Løkseth
- Re: If 1 = 0 Then .... Serious bug in .NET?!
- From: Stephany Young
- Re: If 1 = 0 Then .... Serious bug in .NET?!
- Prev by Date: Re: If 1 = 0 Then .... Serious bug in .NET?!
- Next by Date: Re: lost My Pictures and My Documents folders
- Previous by thread: Re: If 1 = 0 Then .... Serious bug in .NET?!
- Next by thread: Re: If 1 = 0 Then .... Serious bug in .NET?!
- Index(es):
Relevant Pages
|