Debugger Error:Invalid scope kind

BlitzMax Forums/BlitzMax Beginners Area/Debugger Error:Invalid scope kind

Ant(Posted 2006) [#1]
Hi this has been asked before:

http://www.blitzmax.com/Community/posts.php?topic=54306&hl=invalid%20scope

...but didnt receive any responses so I thought I'd see if I have better luck.

I've just stepped through my code and received this error which I've never encountered before:

'Debugger Error:Invalid scope kind'
Process complete

..and the application obviously ends. I've no idea what it means - any ideas?
Thanks!


FlameDuck(Posted 2006) [#2]
Got source?


Ant(Posted 2006) [#3]
Yes, but you wont be able to run it ;-)

Ok the code searches through 3 lists to see if the objects are of the same colour.
On the first iteration it gets to the PlaySound sPop statement, assigned the links again then returns to the first IF statement within the While loop and the error pops up where I've put the asterix




FlameDuck(Posted 2006) [#4]
Anyway, the problem with Haramanai's code is that he's passing an object using the "Var" keyword. Which is nonsense since objects are always passed by reference.

Here is code to reproduce it:
Type MyFloat
	Field value:Float
EndType

Local wrapFloat:MyFloat = New MyFloat
DebugStop 
Test( WrapFLoat )

Function Test:Int( afloat:MyFloat Var)
	Return True
EndFunction
Remove the 'Var' keyword from the function signiture and it works as expected.

This doesn't seem like it's your problem though (as far as I can tell from the source you just posted).


FlameDuck(Posted 2006) [#5]
Yes, but you wont be able to run it ;-)
Well that's not going to do much good. Only thing I can think of is that the TLink in question has a _value field that's pointing to an object that doesn't cast to a TBall - but that should give a null pointer exception, rather than scope exception.


Ant(Posted 2006) [#6]
Unfortunately I cant post it all. Thanks for the tip, I'll have another look


Ant(Posted 2006) [#7]
If I comment out the RemoveLink(previousPathLink ) I no longer get this error, although I haveno reason why....


FlameDuck(Posted 2006) [#8]
Unfortunately I cant post it all. Thanks for the tip, I'll have another look
Maybe you can create a small snippet of code that reproduces it? Or you could mail it to me.

If I comment out the RemoveLink(previousPathLink ) I no longer get this error, although I haveno reason why....
Wow. That's odd. How is previosPath different than nextPath? Could be something there.


Ant(Posted 2006) [#9]
I have a type called TPath. Path contains a list of type Tballs (the list is called ballList)

Previouspath, currentPath and NextPath are all instances of TPath - therefore each containing lists ballList.

PreviousPathLink, currentPathLink and nextpathLink are all links to the first ball in their ballList. (previouspathLink points to previouspath.ballist, nextpathLink points to nexpath.ballist etc).


Ant(Posted 2006) [#10]
Ok, I think the problem comes from my mis understanding of RemoveLink. I thought removeLink removed an object from a list (and seemed to in the code I'd previously been using). However, if I use countlist to get the number of items in a list and then removelist to remove an item (in theory) the value displayed by countlist doesnt decrement - when I expect it to as (I thought) i just removed an item from the list?


tonyg(Posted 2006) [#11]
...then something is wrong somewhere else.
You mention removelist and removelink. Is it possible you're getting your objects and links mixed up?
Type mytype
  Field x
End Type
mylist:Tlist=CreateList()
For x = 1 To 10
  my:mytype = New mytype
  my.x = Rand(0,10)
  ListAddLast mylist,my
Next
Print CountList(mylist)
ListRemove(mylist,my)
Print CountList(mylist)
RemoveLink(mylist.lastlink())
Print CountList(mylist)
mylist.removelast
Print CountList(mylist)



Ant(Posted 2006) [#12]
it was a typo - I'm trying to remove objects in a list with the RemoveLink command. I'm assuming this is an ok way to do it?
And I dont understand why the counlist(mylist) prints '1'......


tonyg(Posted 2006) [#13]
It depends on how you're doing it.
The simple code I posted shows the method you can use. Are you using one of these methods?
How about...
removelink(previousPath.BallList.firstLink())
print countlist(previouspath.balllist)

or whatever it is you're trying to remove rather than
using a variable?
Have you checked the link/object actually exists in that list?
I'm not sure why there isn't an error UNLESS you are running the countlist against a different list.


Ant(Posted 2006) [#14]
But there is my confusion - the output of your code read 1,1,1,1 -was that intended? If so my confusion begins there.

Summary of my code:

I'm assigning a variable TLink to the first object in a list:

previousPathLink=previousPath.BallList.firstLink()

- this seems fine to me, iits getting a value (although is there a way of checking its what I would expect?)

Then (for debug purposes) I'm checking there are objects in the list:

Local a:Int=previousPath.ballList.count()
- which returns 3

Then I'm getting the value of what that link points to:

previousPathBall=TBall(previousPathLink.value())
- which appears to be fine

Then I'm comparing some values which if they are identical I am removing that link (and as I understand it object)

RemoveLink(previousPathLink )

But the first problem is that local variable a which I declared earlier does not change when I would expect it to decrement by 1.


Ant(Posted 2006) [#15]
Ok, I've just ran my code using the debugger and stepped through it and I didnt get the same error - in fact it executed the code where the invalid scope error was generated. This is going to sound ridiculous, but if I step through it slowly, then it works ok, but if I execute without the debugger or step through it rapidly I get this error. Also noticed that the variables in the debugger are VERY slow to update while doing this. I'm not making this up ;-(


tonyg(Posted 2006) [#16]
Are you using 1.14?
That code I posted returns 10,9,8,7 whether in debug/non-debug or if I add debugstop and step through.
I can't believe you can step through it manually quickly enough to make a difference.
If you really get 1,1,1,1 with the code I posted then there's something wrong with your Bmax install.


Ant(Posted 2006) [#17]
Yip, using 1.14 - utterly confused


Ant(Posted 2006) [#18]
Hold on just resynced andI get 10,9,8,7 now....I'll test the problem code tomorrow
Appreciate the help, will let you know the results.

BTW I also deleted my bmx directory and exe's


Ant(Posted 2006) [#19]
This is so frustrating. Couple of questions.

1. When you use removeLink, in the debugger I can see it deletes the _value:Object field while the _succ and _prev link addresses do not change (I expected them to)?
2. Does anyone have adefinition of what Invalid scope kind actually means?
3. In the debugger when I use removelink, it takes several seconds for the debugger to refresh and actually show that the object has been removed from the link - is this normal as I've never experienced this before?

Thanks ;-(


Ant(Posted 2006) [#20]
I've reinstalled BMax and all appears to be ok now - I'm no longer getting that error - thanks to all the advice and help. I'm going to take a large headache pill and lock myself in a cupboard fora couple of weeks