Might need more details on the error.... But let's go there later.
Let's look at what we have.
You may want to start with "4a", and then check the other points.
When following the process in the step-in, it was found that an error occurred in "TWinControl.WSRegisterClass" of "wincontrol.inc".
1) Menu: Project > View Project Source
That should be the file from which you already quoted. With all the "Application.*" calls.
It should start with
program YourProgramsName;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
TestDbgControlForm,
Interfaces, .........
Make sure "Interfaces" is in the "uses" clause.
2)
- Open "Project Options"
- Page "Compiler Options" > "Config and Target"
On the bottom of the page it should say
Current LCL WidgetSet: "win32"
Make sure it is "win32", since you are on Windows. (Yes, this is correct for 64bit too)
3) Do you have any unit with an "initialization" unit?
If you do, does it call any LCL functions like "ShowMessage", or use a "TOpenDialog" ....
In order to find out, set a breakpoint on
RequireDerivedFormResource:=True;
Or, on whatever is the very first line, in the "begin" block of the "project source".
If the error happens, before the breakpoint is reached, then you most likely have something in an "initialization" section.
4)
Do a clean build.
a) You can choose menu: Run > Build
b) Clean by hand
Open the folder with the project.
===> At this point: Backup the entire folder.
There is either a "lib" (or "units") dir.
It contains an x86_64-win64 or i386-win32 subdir.
-> From that subdir, remove all files.
Open all Forms in your project, and modify them (move them a few pixel on your monitor, so the coordinates are changed), the save them.
(The "forms" bit, is 99.9% NOT related to your issue, but just to be save.)
Now "build" again, and test.
5)
More info, if nothing so far has helped or revealed at least more details.
Open the menu: View > Debug Windows > Stack
Copy the content when you hit the error.
The top, up to 3 entries may not have unit/lines. The may have names like "FPC_RUNERROR", "FPC_EXCEPTION", reference to system, sysutils.
After that, if the next lines in the stack, do not have unit names and lines, go to menu: Tools > "Configure build IDE", and add -gw to the Custom options. No need to build, just save. Build and run again, hopefully the stack now has lines.