Lost another big piece of code

This forum is meant for questions and discussions about the X# language and tools
TerryB1
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

Lost another big piece of code

Post by TerryB1 »

Hello Dick
Sorry I took this to be a new topic and had not been following the “spaces / tabs” discussions.
A quick look it seems to me that the problem may be deep-rooted. The fact is that no program can be written on the basis of arbitrary input. Odd ball spaces, tabs or anything else must be filtered out before any program can operate as intended. In many cases this involves “standardizing” input to single space separation between written code – NOT any arbitrary number or bits and bobs – a BNF language specification is a case in point. FWIW it looks to me as though something along those lines is happening here.
Terry
User avatar
OhioJoe
Posts: 131
Joined: Wed Nov 22, 2017 12:51 pm
Location: United States

Lost another big piece of code

Post by OhioJoe »

The solution is consistent backup. Several times a day if necessary. Or at least before lunch and at day's end. (I backup to an old laptop on the network.)
Yes, Wolfgang, it's indeed a good idea to separate the generated code.
Yes, Dick, entity-based editing would help. (Maybe that's why it's hard to ditch VO.)
I agree with Robert. This is no reason to abandon the project.
Joe Curran
Ohio USA
VR
Posts: 102
Joined: Sun Aug 23, 2020 3:07 pm
Location: Italy

Lost another big piece of code

Post by VR »

Just as information:
- Visual Studio has an AutoRecover feature, that can be activated: https://docs.microsoft.com/en-us/visual ... dialog-box
- GitHub offers unlimited public/private repositories for free. Commiting code often to git is very good way to keep backups.
User avatar
Kees Bouw
Posts: 119
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

Lost another big piece of code

Post by Kees Bouw »

VR wrote:Just as information:
- Visual Studio has an AutoRecover feature, that can be activated: https://docs.microsoft.com/en-us/visual ... dialog-box

The AutoRecover feature was activated just like described in the link. On this page there are 2 locations mentioned where these backups could be, but both locations are totally empty. Not sure if this is a VS or X# issue but the feature does not seem to work at all.
User avatar
Kees Bouw
Posts: 119
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

Lost another big piece of code

Post by Kees Bouw »

robert wrote:Dick,
So far Kees has only given us a complaint but no real clue where to look for.
Robert
I will describe as best as I can what happened. I was working on a Winforms window, this window was created with a separate designer.prg (as an option you can create it with or without a designer.prg). The window is called "NewEmail". In the solution explorer there are 3 files related to this window:
NewEmail.Designer.prg: this seems totally generated code and I never change anything in this file.
NewEmail.resx: With this I can view the resources this window uses but I never change anything in this file.
NewEmail.prg: If I double click this I get the window editor. If I double click on (for example) a button in the window, I get the code view of NewEmail.prg where a template is created and I can add code that executes when this button is clicked at runtime. Or, if I select a control on the window and I go to Events and double click an event, I also get the code view and I can add code for the event. In NewEmail.prg I have also added methods of my own, for example a method that fills the controls with actual data, changes captions etc. I can't see how this could be bad practice because you are supposed to edit the code in this prg. Why else would the window editor put templates for methods here other than to add your own code? The problem is that at the moment the window is saved (from the window editor), any code in the prg can be messed up. Sometimes code is overwritten, or duplicated, or moved. It happened to me several times already. In this last case a large chunk completely disappeared. Totally gone up in smoke. So the code can get corrupted when written back to disk, but I don't know what triggers this corruption. It happens sometimes, but not all the time. I will now make a backup of the prg's before saving any change in the window editor. This makes development a lot slower of course but there is nothing worse than losing your code. It feels like your house was burgled.
As I wrote, the Tools->Options->Autorecover feature does not seem to work, at least not in X#. Would it be possible to automatically create a .bak file of every .prg when it is saved? That would help a lot.
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Lost another big piece of code

Post by Chris »

Hi Kees,

Sorry to hear about the problem, but I have to say that even though I've seen several smaller or bigger problems in the form designer, I have never seen it completely deleting code or have ever been reported something like that previously, otherwise we would had investigated, found and fixed that.

So any information you can provide would be very helpful, like does this happen with any of your forms, or only with this one? Anything in common between those forms? Also did it completely delete ALL code? Or some portions maybe? Any additional info you can think of might help..

.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Lost another big piece of code

Post by ic2 »

Hello Volkmar,
KeesIC2 wrote:
VR wrote: both locations are totally empty. Not sure if this is a VS or X# issue but the feature does not seem to work at all.
I can confirm that on the location associated with my VS2019 version, I have a directory for all projects I've been working on, but most directories are either empty or not containing latest changes. Both findings should not happen: according to the set options, Autocorrect should save changes every 5 minutes (which doesn't happen) and files should not remain longer than 7 days (the last changed folder is of 1 project I worked on yesterday, the folder date is yesterday and the folder contains nothing more than 2 .xaml files of May 2021. So it has not deleted >7 days old files and it did not backup anything I changed yesterday.

We can add this to the long list of non working Visual Studio "features".

Dick
User avatar
ArneOrtlinghaus
Posts: 412
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Lost another big piece of code

Post by ArneOrtlinghaus »

Not everything is bad what makes Microsoft.

I like very much working with Visual Studio and I am glad that we could get rid off the old VO IDE.

Arne
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Lost another big piece of code

Post by ic2 »

Hello Wolfgang,
wriedmann wrote:please let me add one very important thing here that both Arne and myself wrote: keep handwritten and generated code in different files!
So how is this supposed to be done?

Example: when I would add a pushbutton on a Windows Form and double click on it, VS creates the event somewhere (seems random) in the .prg or .cs (etc) file. Now that will be in the same file as were the generated code is created, being the same file where Kees lost his hand programmed code.

Is the idea that I would quickly select the code, open my own created prg, copy it there, delete it from the prg were VS created it?

That would add quite some development time....

And Joe, yes you are right. It is hard to say goodbye to the entity based VO programming It's like we had a good 20th century solution with VO and with VS we're not going to the 21st century but we are thrown back to the Middle Ages were we also risk our (program code) life because of bandit Visual Studio lurking randomly to hit.

Dick
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Lost another big piece of code

Post by ic2 »

Hello Arne,

ArneOrtlinghaus wrote:Not everything is bad what makes Microsoft.
I agree with you. I like OneNote (Desktop version) and SpiderSolitaire (Windows 7 version which can run on W10 as well). That's 2 Microsoft products which indeed are not bad.

ArneOrtlinghaus wrote:I like very much working with Visual Studio and I am glad that we could get rid off the old VO IDE.

Yes, we are thrilled too, with hours of programming lost :angry:

Sure, some things are better. E.g. most of the debugging. But the entity based editing is vastly superior to the editing in VS.

Dick
Post Reply