'System.StackOverflowException'

ThePentiumGuy

Well-known member
Joined
May 21, 2003
Messages
1,113
Location
Boston, Massachusetts
hi,

when i run my program (something i made in d3d),
i get this error

An unhandled exception of type System.StackOverflowException occurred in Unknown Module.

i have no idea how to fix this error lol, sry for being so vague but i cant exactly Pinpoint wehre the error originated.. (it says unknown module)


if anyone has encountered this problem, can you please explain where it may originate ( & if possible, how to fix it)
 
wow..
i tracked the problem down
the program seemed to be continuously repeating this line:
Public alex As New clsSprite() this is the first variable in the declarations, so i dont see why it would go through a loop

the statement that (for some reason) caused it to loop:
(in clsSprite) i said:
Inherits D3D_Engine.D3DGraphicsClass the class in which i declared that variable

really odd..
i ahve no idea why vb would do that
 
You can view the Call Stack (ctrl-alt-c) when your program breaks. It will show you all the code thats been called. I would guess youll see two lines of code (or maybe a few more) being called over and over. One of them should provide clues. If you cant get it, let us see some more of your code...

-Nerseus
 
hey,
thanks for the replies..
ctrl alt c doesnt work (maybe thats a vs.net 2003 thing?) o_O

but heres my code

Code:
Public Class D3DGraphicsClass
    Public alex As New clsSprite()
End Class

Public Class clsSprite
    Inherits D3DGraphicsClass
End Class

aand finally form1s declarations: 
    Dim Game As New D3DGraphicsClass()

-(note: this code is the shortened version of my otehr code... -but: i actually tried using this same exact code and it still gives the error)
 
When your application breaks on the stack overflow error, try going to Debug>Windows>Call Stack to see the same thing
 
Code:
Public Class D3DGraphicsClass
    Public alex As New clsSprite()
End Class

Public Class clsSprite
    Inherits D3DGraphicsClass
End Class

aand finally form1s declarations: 
    Dim Game As New D3DGraphicsClass(

clsSprite inherits D3DGraphicsClass - every time you create a clsSprite it calls the D3DGraphicsClass new method - and in its new method you are creating a new sprite etc.
Is there a reason why you are doing it this way?
 
ohh! actually theres no reason why im doing it that way.. lol i didnt realize that it would create the variables again

where would i instantiate clsSprite though?

edit: never mind, i figured it out :-)

thanks for ur help guys
 
Back
Top