robert post=26079 userid=253 wrote:
-next: started to remove variable declarations ... and BINGO, its the "PUBLIC CONST" declaration! So, I'm going to change my code and use the contemporary "rn" where needed. Note: remember, this compiled and executed just fine.
This is what I still don't understand. If this is the cause, how could it have worked previously and not anymore when restoring the complete backup?
If I had an issue like this and restoring a backup, it was invariably some VS problem. Otherwise restoring a backup solved it.
This you wrote, but that still keeps me wondering how it was possible that the earlier version worked for him, and once he did restore this very same working version from the backup it didn't.
I opened an X# solution on which I didn't work for a while. And got this same error (designer could not be shown for this file because none of the classes within it can be designed), on the main window. The MSDN help is useless (as usual) : "The class can be designed, but it is not the first class in the file. Visual Studio requires that designers use the first class in the file."
Of course it is the first (in fact only) class in the file. I've updated X# to 2.18 and, stupid enough, upgraded VS. It looks from the GitHub URL that this error should have been solved, at least from the X# side?
I have deleted the .vs directory, no change. .NET desktop development is checked as installed. For a few other Winforms windows in the solution the designer shows just right. But, also after a restart, this error remains.
There's no PUBLIC CONST in the xxxMainDesigner.prg, just a generated class with private controls of the main Winforms window of our program plus an also generated InitializeComponent and Dispose, which worked (unchanged) until the VS and X# update.
Because VS uses the source code itself for storing the window definition, there are a million reasons which could be causing this error message, and in most cases it's a small bug in the source parsing code component of X#. Can you please send us the project with this window, so we can find what's causing the problem?
Thanks Chris for the offer. Is there anything I can try myself? What I did already:
1 I copied the whole solution directory to another Pc with X# 2.12 still on it, and VS 2019 16.11.5 from October 2021 (instead of the latest 16.11.32). The first time I tried View Designer I got "The designer cannot be shown because the document for it was never loaded". This was solved after restarting VS, so the designer shows my Winform there without problems. I could for example update X# first, then Visual Studio, to see if any of these updates cause the error?
2 I renamed the designer.bak from 2022 to designer.prg, no change
3 I removed all code from the designer.prg except the namespace and class definitions, no change.
If there's no code in form.designer.prg except for the namespace and class, then the problem probably lies in the form.prg file. Try removing code from that, too. Also what's the inherit clause of the form definition?