Lost another big piece of code

This forum is meant for questions and discussions about the X# language and tools
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 »

Lost another big piece of code just by saving the Winforms window. About two full pages of code of which I have no backup, simply deleted. I am very, very angry, unbelievable that this can still happen. I feel a lot of swearing coming up but I guess I will just keep that to myself. No more X# for me.
User avatar
robert
Posts: 4522
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Lost another big piece of code

Post by robert »

Kees,

I am sorry to hear this.
Some suggestions that were also often used by people in VO.
- keep the "hand written" code separated from the generated code (in a seperate module / file) so the window editor will not touch it.
- make frequent backups, or use a version control system and commit often

And if you could elaborate what kind of code this was, then that may help preventing this from happening in the future.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
ArneOrtlinghaus
Posts: 412
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Lost another big piece of code

Post by ArneOrtlinghaus »

The regular backups are so important. How often have I deleted the contents of a complete file or a bigger number of lines by own mistake. Or made a global replacement for all files of the solution. And then lost files because of missing electric energy, complete blocking of windows or program errors.

And for it was also important to separate hand written code from generated code. Unfortunately we still have many classes with many thousands of lines. We divided these classes into several files to have some more security about unwanted changes.

Arne
TerryB1
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

Lost another big piece of code

Post by TerryB1 »

This has nothing at all to do with the X# Language.

What were you using? Visual Studio? Notepad? Something else?

Terry
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Lost another big piece of code

Post by wriedmann »

Hello Kees,
it may seem bad if the recommendations come in after you 've lost your code.
I can only recommend to strictly separate generated and handwritten code - it makes life much, much easier.
Like Arne, it has occurred me several times that I had deleted or overwritten code.
In VO, the VO Productivity Pack with its AutoExport feature is a real lifesaver, and the same is true for XIDE.
Maybe there is an extension for Visual Studio to do that, or, even easier, why not write a small utility that copies the code to a safe location every x minutes (on my development notebook, I have a SDCard only as backup medium),
But I do at least daily uploads to my private Github account - the few backs it costs it is very worth.
And I make a full backup of my development machine every friday when I finish programming, and keep these backups for at least a year (I have 4 different USB disks for them).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

Lost another big piece of code

Post by leon-ts »

Hi,

In my VO projects, I use a database based repository. This is really a problem. How many times have I lost the code due to the fact that the repository was corrupted, not even count. And this is not even when saving forms, but when saving any Entity. At the same time, the entire AEF became inoperable. VO even provides a Reindex operation for minor index-related repository corruption.

Migration to X# is like a breath of fresh air for me. Yes, there are still problems there, and some quite serious ones. But good guys are working on the project, who always help. It is only important to inform them of emerging problems and, if possible, include reproducible examples.

And yes, as mentioned in previous posts, git helps a lot. You can simply undo the last changes you made. It helped me several times even for my own edits - for example, I poorly planned changes in the code, made many edits, and then realized that this was nonsense :) .

Best regards,
Leonid
Best regards,
Leonid
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Lost another big piece of code

Post by ic2 »

It looks like all replies are based upon how to better take care of a backup. But bottom line is that the code get lost because of a serious issue in X#'s Winforms editor (and no Terry, how much I would like to blame VS, I quote Robert here, it is an X# issue, see earlier post in https://www.xsharp.eu/forum/public-chit ... aces#19426).

Going to X# (well, especially Visual Studio and the departure of the entity based editing) means for us the opposite of "breath of fresh air". When code gets lost, something we last had in Cavo 1.x in the last century, that doesn't really help to motivate people working for me. All of us acknowledge the hard work and qualities of the development team but I can imagine Kees refuses to continue on this project until this issue is solved.

Dick
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

Lost another big piece of code

Post by leon-ts »

Dick,

If you only had this problem in CAVO 1.*, then you were more fortunate in this regard than me. My introduction to VO started with version 2.5 and continues until version 2.8SP3. And in all these versions I was inevitably pursued by this problem. For example, only the repository folder of one of my main projects is 1.5GB. This is a "hard" project. And there are three such large projects. Therefore, for me personally, the VO repository is a very strong headache.

Best regards,
Leonid
Best regards,
Leonid
User avatar
robert
Posts: 4522
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Lost another big piece of code

Post by robert »

Dick,
ic2 wrote: but I can imagine Kees refuses to continue on this project until this issue is solved.
We will do all that we can to solve the issue, but if Kees refuses to work with the product, how do we know that it is resolved?
And it would at least help if we have an idea of the kind of source that got lost.
Was it:
- Fields in the Form Class ?
- Methods in the Form Class ?
- Access/Assign in the Form Class ?
- Properties in the Form Class
- Nested classes ?
- Something else ?

So far Kees has only given us a complaint but no real clue where to look for.
As a developer you should know that to fix the problem you need to be able to reproduce it first.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Lost another big piece of code

Post by wriedmann »

Hi Dick,
please let me add one very important thing here that both Arne and myself wrote: keep handwritten and generated code in different files!
That helps both the programmer and the IDE - I remember reports of overwritten or deleted code by two-way tools not only by Microsofts IDE tools, but also by Delphi and Borlands tools.
I would never let an editor decide what can be overwritten and what not!
Wolfgang
@Leonid: since 2.7 the repo of VO is really stable for me, but first I'm rebuilding every VO project at least every year, and then I keep them all below 500 MB. Since we can work with multiple instances of the VO IDE at the same time, there is no need anymore to keep all in one repo.
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply