locked
Program Crashes RRS feed

  • Question

  • XFM301

    Is there any way for it to be crash proof?

    I don't know how to stop it from crashing.

    Would storing some of the variables into an external txt help?

    If so, how?

    Monday, December 15, 2014 5:41 PM

Answers

  • For example, following code causes the same exception that your code causes.

    depth = 0
    subroutine()
    Sub subroutine
      depth = depth + 1
      TextWindow.Write("depth=" + depth)
      subroutine()
    EndSub
    
    I guess that this is because of lacking internal stack.  Subroutine call consumes stack memory and that memory will be released at return time.  But this code doesn't return at all.


    Nonki Takahashi

    Thursday, December 18, 2014 7:10 AM
  • Hi guys,

    Last year there was a thread on the forum about a SB-logger, which can put all sort of logging information to a file, including subs, linenumbers.

    Here is the link to the program:

    http://gallery.technet.microsoft.com/sb-logger-A-Small-Basic-afcc91ad

    You can find the thread by searching on this forum for "logger"


    Jan [ WhTurner ] The Netherlands

    Saturday, December 20, 2014 1:57 PM
    Answerer
  • Would storing some of the variables into an external txt help?

    If so, how?

    Other way:

    * LDFile.SaveAllVariables(fileName)

    * LDFile.LoadAllVariables(fileName)

    like eg:

    now = Clock.ElapsedMilliseconds
    currConfig = File.GetSettingsFilePath()

    '' some Code here
    varA = 5.6
    arrB = "1=Hello world;2=123;3=true;"
    strC = "blaBla"
    btn1 = Controls.AddButton("DemoBtn", 10,10)

    '' some Code there, then...
    now = Clock.ElapsedMilliseconds -now
    LDFile.SaveAllVariables(currConfig)
    TextWindow.WriteLine(File.ReadContents(currConfig))

    '' maybe some time and code later
    'LDFile.LoadAllVariables(currConfig)

    Saturday, December 20, 2014 2:39 PM
    Answerer
  • The problem is probably in the subroutine "Reciept" in wich a for loop calls 60 times Reciept() without returning.

    Jan [ WhTurner ] The Netherlands

    Saturday, December 20, 2014 5:42 PM
    Answerer

All replies

  • My first impression is that subroutine call nesting is too deep...

    Nonki Takahashi

    Thursday, December 18, 2014 3:53 AM
  • For example, following code causes the same exception that your code causes.

    depth = 0
    subroutine()
    Sub subroutine
      depth = depth + 1
      TextWindow.Write("depth=" + depth)
      subroutine()
    EndSub
    
    I guess that this is because of lacking internal stack.  Subroutine call consumes stack memory and that memory will be released at return time.  But this code doesn't return at all.


    Nonki Takahashi

    Thursday, December 18, 2014 7:10 AM
  • Would storing some of the variables into an external txt help?

    If so, how?

    This is good idea for debugging.  How about to write subroutine name at the top of each subroutine to a log text file?

    Nonki Takahashi

    Saturday, December 20, 2014 6:47 AM
  • Hi guys,

    Last year there was a thread on the forum about a SB-logger, which can put all sort of logging information to a file, including subs, linenumbers.

    Here is the link to the program:

    http://gallery.technet.microsoft.com/sb-logger-A-Small-Basic-afcc91ad

    You can find the thread by searching on this forum for "logger"


    Jan [ WhTurner ] The Netherlands

    Saturday, December 20, 2014 1:57 PM
    Answerer
  • Would storing some of the variables into an external txt help?

    If so, how?

    Other way:

    * LDFile.SaveAllVariables(fileName)

    * LDFile.LoadAllVariables(fileName)

    like eg:

    now = Clock.ElapsedMilliseconds
    currConfig = File.GetSettingsFilePath()

    '' some Code here
    varA = 5.6
    arrB = "1=Hello world;2=123;3=true;"
    strC = "blaBla"
    btn1 = Controls.AddButton("DemoBtn", 10,10)

    '' some Code there, then...
    now = Clock.ElapsedMilliseconds -now
    LDFile.SaveAllVariables(currConfig)
    TextWindow.WriteLine(File.ReadContents(currConfig))

    '' maybe some time and code later
    'LDFile.LoadAllVariables(currConfig)

    Saturday, December 20, 2014 2:39 PM
    Answerer
  • The problem is probably in the subroutine "Reciept" in wich a for loop calls 60 times Reciept() without returning.

    Jan [ WhTurner ] The Netherlands

    Saturday, December 20, 2014 5:42 PM
    Answerer