Recovering a broken project & version control lazarus / 13-General ---------------------------------------------------------------------- tomm · 2020-05-02 21:51 I was getting on ok with finding out how to build a database app in Lazarus until something broke in the project config. I'm not exactly sure now what happened, - I think something crashed, I restarted the IDE & got an error dialog asking if I wanted to abort or continue - & I chose to continue. Anyhow when I try to reopen that project the IDE freezes saying "Source editor not responding". I've made various attempts to create a fresh project directory & rebuild so I can use the unit1.pas & unit.lfm files I'd created, but with the similar results - mostly the with IDE freezing when started. Can I rebuild the project from the wreckage of the old project directory or do I have to just start all over again - with proper version control this time - in which case it would be really helpful to know which files I need to keep under control to be able to rebuild in future. ---------------------------------------------------------------------- eljo · 2020-05-02 22:23 have you opened the unit1.pas file in notepad (for example)? what does it show? The lfm is text also so open with any text editor and see if there is something wrong or missing. If you can figure it out compress them and attach them in a message so we can take a look on the files and see if there is anything that can be retrieved. ---------------------------------------------------------------------- winni · 2020-05-02 22:55 Hi! If eljos tip does not work: There is a backup directory in your project directory. Look with an editor if the files look okay. Then rename the files and look if you can start the project from there. Winni ---------------------------------------------------------------------- Martin_fr · 2020-05-02 23:05 "SourceEditor not responding" means opening the project hangs your IDE. First of all, depending on how sensitive the project is, could you provide us (the Team, Lazarus) with a copy, so we can try and find the bug in the IDE, and fix it? Make a backup of your project. Try removing the *.lps file. It may be in your primary config path (maybe in a subfolder projectsessions) ~/lazarus c:\users\YOURNAME\appdata\local\lazarus If that does not work, remove the lpi file, and open the lpr. It will ask to create a new project. Choose the type (eg Application). -- If there are backups of lps/lpi you can try them. -- Btw: What OS do you use? What version of Lazarus? ---------------------------------------------------------------------- tomm · 2020-05-03 15:08 Thanks to Eljo & Winni.  There's nothing obviously wrong with the .pas & .lfm files, If I were a compiler I might choke but my human syntax analyser doesn't see anything immediately. @Martin_fr : Versions : Win10, Lazarus 2.0.6 (32-bit to match postrgres library), FPC 3.0.4 I've made a bit of progress.  By cleaning up any file I didn't make by hand & following Martin's lead I now have  project that makes an executable I can step through, but no form appears on screen. It seems the initialisation of the form at runtime silently fails the code in Project.lpr is begin   RequireDerivedFormResource:=True;   Application.Scaled:=True;   Application.Initialize;   Application.CreateForm(TForm1, Form1); // at this point if I try to evaluate   Form1.visible   the 'Watch' window says : //   Application.Run;   // No window appears end.  I'd guess I'm not referencing a unit - I am attaching the project, but I can probably find this now. My other question was which files do I put under version control to prevent this in future - should I open that as another topic ? Thanks for your help. ---------------------------------------------------------------------- howardpc · 2020-05-03 15:30 Your app compiles and shows a form here (see attached recovered project). Without your database and client library installed I have no idea if your program logic works, of course. I simply created an "a.txt" file, and removed the name of your DBConnection's DatabaseName. ---------------------------------------------------------------------- Martin_fr · 2020-05-03 15:40 Quote from: tomm on May 03, 2020, 05:08:45 pmIt seems the initialisation of the form at runtime silently fails Comes up for me, if I skip the "a.txt" and related code at the begin (since I do not have the file) Maybe try to move your form (in the designer, just change screen pos) and save it. So it gets rewritten. Also delete the entire contents of the "lib" folder. It will be regenerated. Quote// at this point if I try to evaluate   Form1.visible   the 'Watch' window says : // That is a shortcoming of the debugger. https://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Properties QuoteMy other question was which files do I put under version control to prevent this in future - should I open that as another topic ? Exclude the folder lib and backup You need - project.lpi => the project file, the IDE stores all your setting in there. All the stuff, you can set under "Project Options" and "Project Inspector" - project.lpr => the main source file. It is auto generated. But you should really store it. (Not sure if it will be completely recreated on its own, if it went missing) - any *.pas *.pp  *.inc file that you create (any pascal source file). - Any *.lfm file (except from lib folder, those are copies). lfm store all the settings you made to your form. - the *.ico file. (You can skip it, if you did not set an icon. In that case it gets recreated - the *.res file (Again, it gets recreated, if you did not add resources, or icon of your own. And if you create other files, that you then load in your project => add them too.... And if you wish the project.lps file. However only if you do have no co-workers on the project. The lps (session) file stores the location of the editor, and IDE windows on your screen. How for the source file was scrolled. What files you had open in the editor (tabs).... If you have a co-worker he has its own session. If it is for backup => store it. -------------- EDIT If you do version control, consider getting an online account. E.g. if you use git, you can create a private repro at github. You can push your changes there, and you are covered should your hard disk fail. If you do, even though it may be a private repro, do not put password or the like in there. ---------------------------------------------------------------------- tomm · 2020-05-03 21:14 Thank you so much everyone - This is the kind of mistake that can happen getting familiar with an environment, and it's been very reassuring that you've been there for me.  Lazarus / FPC is an amazing project ! Thanks for being so helpful.  It's very much appreciated.