Recent

Author Topic: runtime error Invalid class .  (Read 3276 times)

aducom

  • Full Member
  • ***
  • Posts: 162
    • http://www.aducom.com
runtime error Invalid class .
« on: February 27, 2022, 09:23:02 pm »
I have a strange error, that does not occur on each machine. I created an application with Lazarus. If I start it on a second laptop, then I get the error 'Invalid class .' Press OK etc. Does someone have seen this before, and is there some clue where to search for? It is running fine on my development environment. It is not much info, but it is all I have.

Thnx, Albert

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: runtime error Invalid class .
« Reply #1 on: February 27, 2022, 10:04:58 pm »
Perhaps arising from a missing or corrupt .lfm file?

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1315
Re: runtime error Invalid class .
« Reply #2 on: February 28, 2022, 02:37:55 pm »
Perhaps you try to access a class from an external library or the OS, and the .so or .DLL is missing?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12288
  • Debugger - SynEdit - and more
    • wiki
Re: runtime error Invalid class .
« Reply #3 on: February 28, 2022, 03:16:53 pm »
I have a strange error, that does not occur on each machine. I created an application with Lazarus. If I start it on a second laptop, then I get the error 'Invalid class .' Press OK etc. Does someone have seen this before, and is there some clue where to search for? It is running fine on my development environment. It is not much info, but it is all I have.

You could copy gdb.exe on your laptop (where you get the error). You should at least compile your app with line info -gl (but ideally debug info: -gw )

Code: Text  [Select][+][-]
  1. gdb.exe yourproject.exe
  2. b FPC_RAISEEXCEPTION
  3. b FPC_RUNERROR
  4. r

If you hit FPC_RUNERROR => then there is no exception message (there may be a subsequent exception). However, a FPC_RUNERROR means you should be at the point of error that is of interrest. RunErrors should not happen otherwise.

If you hit an FPC_RAISEEXCEPTION, you may want to check if it is the one your are looking for. There may be other, expected exceptions that will be caught and that you need to skip.
To continue your app when gdb paused it (e.g. if you are at an unrelated exception:  c (and enter)

If you got the right exception, get a stacktrace: bt

To see the exception message (replace $rcx as needed):
- If you have full debug info:  x/s Exception($rcx).FMessage
  or sometimes:                    x/s ^Exception($rcx)^.FMessage
- If the above does not work: x/s ^^char(^^char($rcx)+1)^

Depending on your OS:
- On Win 64 use   $rcx
- On Linux 64 use $rdi
- On Win 32 use   $eax

If you can't get the exception message, just get the stacktrace, and continue. You will then see, if the error message pops up, or if you run into another exception later.


« Last Edit: February 28, 2022, 03:23:39 pm by Martin_fr »

aducom

  • Full Member
  • ***
  • Posts: 162
    • http://www.aducom.com
Re: runtime error Invalid class .
« Reply #4 on: February 28, 2022, 10:01:45 pm »
Thanks for all hints. This was an odd issue, but it was an external lib issue. After a reinstall of windows, it worked.

 

TinyPortal © 2005-2018