Just as you move a step forward ...
I have a few XSharp Windows forms projects I've used for testing. They worked fine. Now, when I access the forms designer I get "The designer could not be shown for this file because none of the classes within it can be designed. "
I set up a new project, which ran just fine. Then, I added a 'class' to the project ( a PRG file) and could no longer access the forms designer of the previously working Form without getting that same error message.
I make constant backups (me of little faith) so simply restored the latest backup which had been working fine ... and get the same error.
So, I deleted everything from the project folder - to start fresh - and copied the backup in. Sill that error.
Any ideas? This is quite frustrating. I culd understand it if I had made changes where I shouldn't, but we're talking about projects that were fine and now have an issue with the forms designer. BTW, they compile and run fine, I just can use the forms designer.
Sudden VS Form Design error: The designer could not be shown for this file ...
Sudden VS Form Design error: The designer could not be shown for this file ...
Hi Roland,
Could be many things, another prg in the project interfering, a modified dll, stuff like that. If you'd like, please zip and post your solution folder so we can have a look.
Could be many things, another prg in the project interfering, a modified dll, stuff like that. If you'd like, please zip and post your solution folder so we can have a look.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Sudden VS Form Design error: The designer could not be shown for this file ...
Hello Ronald,
It is one of the many joys of Visual Studio. Contrary to VO, once every few weeks or month you can spend some nice time trying to get your project working again and get rid of some incomprehensible VS error.
There are many posts about it. As usual, Microsoft engineers (or bots) reply "Need more info". From this post:
https://developercommunity.visualstudio ... ca/1003751
it looks like installing the .NET desktop development solved it. But I would start with what I read here although the message is a bit different (I think VS engineers have programmed a few dozens of stupid error messages so you never get bored):
https://developercommunity.visualstudio ... ner/941165
I just deleted the .vs directory in the solution directory and restarted VS 2019 Preview 5. Now the form is loading again.
This way I've solved one of those many VS issues once. Bottom line: it is very likely that not your solution (the backup version worked after all) but your VS environment is the cause.
Dick
It is one of the many joys of Visual Studio. Contrary to VO, once every few weeks or month you can spend some nice time trying to get your project working again and get rid of some incomprehensible VS error.
There are many posts about it. As usual, Microsoft engineers (or bots) reply "Need more info". From this post:
https://developercommunity.visualstudio ... ca/1003751
it looks like installing the .NET desktop development solved it. But I would start with what I read here although the message is a bit different (I think VS engineers have programmed a few dozens of stupid error messages so you never get bored):
https://developercommunity.visualstudio ... ner/941165
I just deleted the .vs directory in the solution directory and restarted VS 2019 Preview 5. Now the form is loading again.
This way I've solved one of those many VS issues once. Bottom line: it is very likely that not your solution (the backup version worked after all) but your VS environment is the cause.
Dick
Sudden VS Form Design error: The designer could not be shown for this file ...
Closing VS, deleting the .vs folder and restarting is indeed a very possible solution to the problem, if that fixes it, it means the intellisense database was corrupted. But could be something totally different, too.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Sudden VS Form Design error: The designer could not be shown for this file ...
Thanks for your tips my friends. I had tried a few of those - to no avail. So, I decided to take the crude hammer approach: eliminate code bit by bit.
-First, i removed all references to labels, buttons etc. : still didn't work.
-next, I removed all my code, bit by bit (no pun intended ..): nope.
-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.
Going forward , not am I only going to continue with my frequent backups, but also after near every change, open the form designer for each form.
-First, i removed all references to labels, buttons etc. : still didn't work.
-next, I removed all my code, bit by bit (no pun intended ..): nope.
-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.
Going forward , not am I only going to continue with my frequent backups, but also after near every change, open the form designer for each form.
Code: Select all
USING System
USING System.Collections.Generic
USING System.ComponentModel
USING System.Data
USING System.Drawing
USING System.Linq
USING System.Text
USING System.Threading.Tasks
USING System.Windows.Forms
BEGIN NAMESPACE OSSPremiumDeductions
PUBLIC PARTIAL CLASS Form1 ;
INHERIT System.Windows.Forms.Form
PUBLIC lPropSaved := .f.
PUBLIC nTaxRate AS DECIMAL
PUBLIC CONST CrLf := chr(13)+chr(10) AS STRING <------ this is the offending line
PUBLIC CONSTRUCTOR() STRICT//Form1
InitializeComponent()
RETURN
END CONSTRUCTOR
END CLASS
END NAMESPACE
Sudden VS Form Design error: The designer could not be shown for this file ...
Roland,
-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.
Can you show us that code, so we can make sure that it gets handled correctly in the future?
Robert
-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.
Can you show us that code, so we can make sure that it gets handled correctly in the future?
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Sudden VS Form Design error: The designer could not be shown for this file ...
Robert,
It's when calling any function in a field declaration, I will log a report for this.
Roland, good catch, this procedure is exactly what I would also follow if you had sent the code, to find the problem. I'm sure Robert can fix this, so it will be possible to use this code in one of the next builds.
.
It's when calling any function in a field declaration, I will log a report for this.
Roland, good catch, this procedure is exactly what I would also follow if you had sent the code, to find the problem. I'm sure Robert can fix this, so it will be possible to use this code in one of the next builds.
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Sudden VS Form Design error: The designer could not be shown for this file ...
Hi Robert, the code is in my original post.Cheers.
Sudden VS Form Design error: The designer could not be shown for this file ...
Hi Chris,
the problem occurs also for non CONST declarations. For example this
also causes the problem; compiles and runs fine but messes up the form designer. The workaround is of course to assign the value elsewhere, for e.g. in the constructor.
Thanks,
Roland
the problem occurs also for non CONST declarations. For example this
Code: Select all
PUBLIC CrLf := chr(13)+chr(10) AS STRING
Thanks,
Roland
Sudden VS Form Design error: The designer could not be shown for this file ...
Hi Roland,
Thanks, I have covered this in the reported cases, the logged issue can be found at https://github.com/X-Sharp/XSharpPublic/issues/1251
.
Thanks, I have covered this in the reported cases, the logged issue can be found at https://github.com/X-Sharp/XSharpPublic/issues/1251
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu