Solving: Expected class, delegate, enum, interface, or struc

Tips submitted by ASP.NET Maker users

Solving: Expected class, delegate, enum, interface, or struc

Postby xgis » Sun Aug 04, 2013 3:48 pm

Troubleshooting an elusive error like this one can be difficult and may cause hours of downtime.
If you have imported a project from ASPMaker that has existing code this error may eventually surface.
When importing an existing project and resolving errors like this one ensure you make Zip/Rar Named and Dat Time based backups when ANM10 generation milestones are achieved.
Another good tip is to only work on one table at a time. eg smallest 1st, especially if you are not familiar with the new razor syntax or implementation of c# by the code generator.

ANM10 does not have an undo feature so if you make a change it is usually permanent. In this example it was actually the old commented code that caused the issue.
I had 10 plus coded pages that were commented in the migration process.
To resolve the error simply delete all the existing code for each "Code" event. It is OK to leave "Client Scripts" intact, at least for this error.
Regenerate your table and test and it should compile.

Open a 2nd copy of the application to view your deleted code.
Start rebuilding it section at a time then generate, test, repeat until all of your existing code is functional.
Once you have completed a table make a backup as a zip or rar then continue.
Don't forget to use structured and datetime based names so you don't get lost in your backups.

Do not rely on ANM10 backups for this type of troubleshooting because each time you save a normal backup is created.
You can only save 10 times before you first backup is overwritten.
That is why you backup the project manually as a zip or rar.
xgis
 
Posts: 87
Joined: Thu Jan 17, 2013 10:40 pm

Re: Solving: Expected class, delegate, enum, interface, or s

Postby xgis » Sun Aug 04, 2013 5:47 pm

This error may also appear in more simpler circumstances during testing where an extra fish brace "}" is present at the end of your code.
Don't forget to check for the simplest solutions first.
xgis
 
Posts: 87
Joined: Thu Jan 17, 2013 10:40 pm

Re: Solving: Expected class, delegate, enum, interface, or s

Postby unicorn9005 » Sat Feb 21, 2015 3:54 pm

Another good tip is to only work on one table at a time. eg smallest 1st, especially if you are not familiar with the new razor syntax or implementation of c# by the code generator....???



_______________
watson
unicorn9005
 
Posts: 1
Joined: Sat Feb 21, 2015 3:47 pm


Return to User Submited Tips (ASP.NET Maker)