-
My Form Reset
I just had something really odd happen. I started writing a little tool targeting .NET 5 in VS2019. I put a handful of controls on a form, changed a few properties, added a few event handlers...then went outside and worked on some sprinkler valves, which probably isn't related.
When I got back, I wrote some of the backing code, and went to populate a listbox only to find that my form had been totally erased. All the controls were gone, the form title had reverted to Form1, and so on. All the Handles clauses had been removed from the control event handlers, as well.
I've never seen this happen. The project wasn't closed and reopened, I had left it open. It had been saved several times after various changes had been made, so it wasn't new in that sense either. The form was there, it had just been reset to empty, and I'm not quite sure when.
There were only a couple things I did that seem like they could have triggered a reset like that, but neither one should have done so: I changed the target from AnyCPU to x86, and I tried adding, then removing, some settings. Something was going wrong with the settings, because I got error messages when I added the settings file, which was fixed by restarting VS, but I got more error messages when I added the second setting, and errors when I removed them. I don't remember much about those messages, aside from them saying something about an error creating the XML file, or something like that, but since I decided that I didn't need the settings, I didn't pay a whole lot of attention to them.
Changing the CPU target should have no impact. I've done that plenty of times.
Has anybody seen that happen, or can anybody explain what could have happened?
-
Re: My Form Reset
Did you ever actually run the program? I only ask this because that would have saved all the modification you made. If not and you never saved your modification, almost any glitch could cause you to lose the mod's.
-
Re: My Form Reset
I hadn't run the program, as it wasn't to that state, yet. I'd be shocked if I hadn't saved it...but I suppose that's possible.
-
Re: My Form Reset
Well I never had this happen. The only time I have ever seen anything close to this happening is when you tinker with designer generated code and muck it up somehow but it just doesn't erase everything completely.
At this point I'm thinking maybe one of your children/nieces/nephews went on your PC while you went to work on your sprinklers, messed it up and realized what they had done and chose to stay silent for fear of being punished.
-
Re: My Form Reset
Nope, unless there were gremlins, I was the only one around.
I'm beginning to lean towards a reason that I find very surprising: I did it.
At one point, I closed VS and restarted. As I write this, I forget what that was about, but it happened. Is it possible that I didn't save? Had I gotten the standard box about wanting to save various things, I would certainly have saved my work, so either I didn't get prompted to save, or this isn't the right reason, but it was all gone, and not saving my work is the one way that I KNOW that could happen. However, it requires both that I hadn't saved my work anyways (which I usually do quite often out of habit), and that I got no prompt to save my work. That seems unlikely, but the only option I can think of.
Basically, this was so surprising to me that I posted this thread. This would have required me to violate long-standing habits, or it would have had to be caused by something odd in VS. I felt it surprising enough to ask about it.
-
Re: My Form Reset
Yea, you probably forgot to save. The revert you described sounded to clean to be a bug. Everything reverted nice and neat no problem. Doesn't sound right for a bug, you know...
-
Re: My Form Reset
Doesn't does it, but then again, not being prompted to save doesn't sound right, either.
-
Re: My Form Reset
I don't know about your system but it's not uncommon for mine to be rebooted by MS. Though, it usually does it overnight. Sometimes the VS I have left open will restart, sometimes not. I never worry about it because it's all just a hobby to me now a days.
-
Re: My Form Reset
Speaking of gremlins. Just yesterday, I was doing what I do at my PC. I left it, just like Shaggy did, did something else for a while. When I came back, my PC was mysteriously off. My first thought was that somebody did something, tripped a wire, turned it off but I was near enough to know that no one went in my room during the time I left. There was no power outage or surge of any kind. Weirdest thing I ever seen. I have zero explanation for what happened. My PC is still new and it is very stable. It gives zero problems. There is just nothing that can explain what I saw yesterday.