Integer not incrementing in Windows Vista, is in XP Pro/Home

Integer not incrementing in Windows Vista, is in XP Pro/Home

am 27.10.2007 20:03:01 von MikeK

I have a Net 2.0 app in VB that has code like this:

Dim intA as Integer
Dim intB as Integer
dim myList as new List(Of String)

intA = 10
intB = 20

.... code to fill the list ....

intA = intA + 1
intB = intB + 1

Then I insert into a list of type String, like so:

myList.Insert("the value being inserted here is " & intA, intB)

On XP Pro/Home, the list inserts using intA = 11 and intB = 21.
But on Vista, my beta users report that the Insert is using the previous
values 10 and 20 respectively. I am unable to recreate this problem myself
on Vista.

Does anyone have insight as to why this is happening? Thank you in advance.

RE: Integer not incrementing in Windows Vista, is in XP Pro/Home

am 28.10.2007 13:11:00 von Guy

Sounds odd, I suspect it is something else in the app or the way the
customers use it that is affecting this.
The best thing would be to run your app through the debugger at a 'tame'
customers site and see wether the integers are not incrementing or are being
added to the list incorrectly

Oh, and turn Option Strict on!

Guy

"Mike K" wrote:

> I have a Net 2.0 app in VB that has code like this:
>
> Dim intA as Integer
> Dim intB as Integer
> dim myList as new List(Of String)
>
> intA = 10
> intB = 20
>
> ... code to fill the list ....
>
> intA = intA + 1
> intB = intB + 1
>
> Then I insert into a list of type String, like so:
>
> myList.Insert("the value being inserted here is " & intA, intB)
>
> On XP Pro/Home, the list inserts using intA = 11 and intB = 21.
> But on Vista, my beta users report that the Insert is using the previous
> values 10 and 20 respectively. I am unable to recreate this problem myself
> on Vista.
>
> Does anyone have insight as to why this is happening? Thank you in advance.

Re: Integer not incrementing in Windows Vista, is in XP Pro/Home

am 28.10.2007 20:14:50 von Guffa

Mike K wrote:
> I have a Net 2.0 app in VB that has code like this:
>
> Dim intA as Integer
> Dim intB as Integer
> dim myList as new List(Of String)
>
> intA = 10
> intB = 20
>
> ... code to fill the list ....
>
> intA = intA + 1
> intB = intB + 1
>
> Then I insert into a list of type String, like so:
>
> myList.Insert("the value being inserted here is " & intA, intB)

You are certainly not.

The Insert method takes two parameters, where the first is an integer
and the second is a string.

> On XP Pro/Home, the list inserts using intA = 11 and intB = 21.
> But on Vista, my beta users report that the Insert is using the previous
> values 10 and 20 respectively. I am unable to recreate this problem myself
> on Vista.
>
> Does anyone have insight as to why this is happening? Thank you in advance.

Without seeing some of the code that you are actually using, it's very
hard to even have an idea about what's happening.

--
Göran Andersson
_____
http://www.guffa.com

Re: Integer not incrementing in Windows Vista, is in XP Pro/Home

am 28.10.2007 21:30:00 von MikeK

"Göran Andersson" wrote:

> Mike K wrote:
> > I have a Net 2.0 app in VB that has code like this:
> >
> > Dim intA as Integer
> > Dim intB as Integer
> > dim myList as new List(Of String)
> >
> > intA = 10
> > intB = 20
> >
> > ... code to fill the list ....
> >
> > intA = intA + 1
> > intB = intB + 1
> >
> > Then I insert into a list of type String, like so:
> >
> > myList.Insert("the value being inserted here is " & intA, intB)
>
> You are certainly not.
>
> The Insert method takes two parameters, where the first is an integer
> and the second is a string.
>
> > On XP Pro/Home, the list inserts using intA = 11 and intB = 21.
> > But on Vista, my beta users report that the Insert is using the previous
> > values 10 and 20 respectively. I am unable to recreate this problem myself
> > on Vista.
> >
> > Does anyone have insight as to why this is happening? Thank you in advance.
>
> Without seeing some of the code that you are actually using, it's very
> hard to even have an idea about what's happening.
>
> --
> Göran Andersson
> _____
> http://www.guffa.com
>

My mistake; I reversed the arguments of myList.Insert as I typed my
question. However the arguments' order are correct in my code.
The main point is why the Insert method would use the integers' previous
vakues.

I've learned that the problem machine is running 64-bit Vista on a 64-bit
dual-core machine. I am looking into whether dual-core is the problem or not.

Re: Integer not incrementing in Windows Vista, is in XP Pro/Home

am 28.10.2007 21:51:57 von newsgroups_remove

Hello,

are you, by any chance, doing this stuff in paralell on multiple threads?

If so, you must protect access to the list with some sort of locking
mechanism (SyncLock statement in VB). Otherwise you might end up with a
race condition which might or might not occur on a single processor machine.

Kind regards,
Henning Krause


"Mike K" wrote in message
news:9128BCF0-6674-48A8-82D6-B557B5D7FB4E@microsoft.com...
>
>
> "Göran Andersson" wrote:
>
>> Mike K wrote:
>> > I have a Net 2.0 app in VB that has code like this:
>> >
>> > Dim intA as Integer
>> > Dim intB as Integer
>> > dim myList as new List(Of String)
>> >
>> > intA = 10
>> > intB = 20
>> >
>> > ... code to fill the list ....
>> >
>> > intA = intA + 1
>> > intB = intB + 1
>> >
>> > Then I insert into a list of type String, like so:
>> >
>> > myList.Insert("the value being inserted here is " & intA, intB)
>>
>> You are certainly not.
>>
>> The Insert method takes two parameters, where the first is an integer
>> and the second is a string.
>>
>> > On XP Pro/Home, the list inserts using intA = 11 and intB = 21.
>> > But on Vista, my beta users report that the Insert is using the
>> > previous
>> > values 10 and 20 respectively. I am unable to recreate this problem
>> > myself
>> > on Vista.
>> >
>> > Does anyone have insight as to why this is happening? Thank you in
>> > advance.
>>
>> Without seeing some of the code that you are actually using, it's very
>> hard to even have an idea about what's happening.
>>
>> --
>> Göran Andersson
>> _____
>> http://www.guffa.com
>>
>
> My mistake; I reversed the arguments of myList.Insert as I typed my
> question. However the arguments' order are correct in my code.
> The main point is why the Insert method would use the integers' previous
> vakues.
>
> I've learned that the problem machine is running 64-bit Vista on a 64-bit
> dual-core machine. I am looking into whether dual-core is the problem or
> not.

Re: Integer not incrementing in Windows Vista, is in XP Pro/Home

am 29.10.2007 14:26:01 von MikeK

"Henning Krause [MVP - Exchange]" wrote:

> Hello,
>
> are you, by any chance, doing this stuff in paralell on multiple threads?
>
> If so, you must protect access to the list with some sort of locking
> mechanism (SyncLock statement in VB). Otherwise you might end up with a
> race condition which might or might not occur on a single processor machine.
>
> Kind regards,
> Henning Krause

Henning, thanks for replying. The problem code is on the main thread. I do
have another thread on which most my other methods run on, but they don't
read or write the 2 problem integer variables.

Even though it's on the main thread, I'll try wrapping the code in SyncLock
anyway to see if that makes a difference.

Thanks.

>
>
> "Mike K" wrote in message
> news:9128BCF0-6674-48A8-82D6-B557B5D7FB4E@microsoft.com...
> >
> >
> > "Göran Andersson" wrote:
> >
> >> Mike K wrote:
> >> > I have a Net 2.0 app in VB that has code like this:
> >> >
> >> > Dim intA as Integer
> >> > Dim intB as Integer
> >> > dim myList as new List(Of String)
> >> >
> >> > intA = 10
> >> > intB = 20
> >> >
> >> > ... code to fill the list ....
> >> >
> >> > intA = intA + 1
> >> > intB = intB + 1
> >> >
> >> > Then I insert into a list of type String, like so:
> >> >
> >> > myList.Insert("the value being inserted here is " & intA, intB)
> >>
> >> You are certainly not.
> >>
> >> The Insert method takes two parameters, where the first is an integer
> >> and the second is a string.
> >>
> >> > On XP Pro/Home, the list inserts using intA = 11 and intB = 21.
> >> > But on Vista, my beta users report that the Insert is using the
> >> > previous
> >> > values 10 and 20 respectively. I am unable to recreate this problem
> >> > myself
> >> > on Vista.
> >> >
> >> > Does anyone have insight as to why this is happening? Thank you in
> >> > advance.
> >>
> >> Without seeing some of the code that you are actually using, it's very
> >> hard to even have an idea about what's happening.
> >>
> >> --
> >> Göran Andersson
> >> _____
> >> http://www.guffa.com
> >>
> >
> > My mistake; I reversed the arguments of myList.Insert as I typed my
> > question. However the arguments' order are correct in my code.
> > The main point is why the Insert method would use the integers' previous
> > vakues.
> >
> > I've learned that the problem machine is running 64-bit Vista on a 64-bit
> > dual-core machine. I am looking into whether dual-core is the problem or
> > not.
>
>

Re: Integer not incrementing in Windows Vista, is in XP Pro/Home

am 29.10.2007 14:58:00 von Guffa

Mike K wrote:
>
> "Henning Krause [MVP - Exchange]" wrote:
>
>> Hello,
>>
>> are you, by any chance, doing this stuff in paralell on multiple threads?
>>
>> If so, you must protect access to the list with some sort of locking
>> mechanism (SyncLock statement in VB). Otherwise you might end up with a
>> race condition which might or might not occur on a single processor machine.
>>
>> Kind regards,
>> Henning Krause
>
> Henning, thanks for replying. The problem code is on the main thread. I do
> have another thread on which most my other methods run on, but they don't
> read or write the 2 problem integer variables.
>
> Even though it's on the main thread, I'll try wrapping the code in SyncLock
> anyway to see if that makes a difference.
>
> Thanks.
>

Putting a SyncLock around a single piece of code only has any effect if
more than one thread is using that code. If only the main thread is
using that code, it doesn't make any difference.

You can spend the time to try it, though. If it makes any difference,
there are two possibilities. Either that more than one thread is using
the code, which means that there is something wrong with your threads,
or that it changed the execution time, which means that it's a race
condition between threads.

--
Göran Andersson
_____
http://www.guffa.com

Re: Integer not incrementing in Windows Vista, is in XP Pro/Home

am 29.10.2007 15:05:02 von Guffa

Mike K wrote:
> My mistake; I reversed the arguments of myList.Insert as I typed my
> question. However the arguments' order are correct in my code.
> The main point is why the Insert method would use the integers' previous
> vakues.

If you did paste the actual code, it might be possible to spot the
problem right away. It might be a very simple mistake in the code, but
as noone other than you can see the code, we're just guessing here.

The code that you have written in the post is too incomplete to make any
sense anyway. You are inserting an item at index 20 in an empty list,
which is of couse not possible at all.

--
Göran Andersson
_____
http://www.guffa.com