fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Error XS1558 'Functions' does not have a suitable static Start method

Error XS1558 'Functions' does not have a suitable static Start method 11 months 2 weeks ago #1

Despite Wolfgangs advice to start over with a new WPF project I still try to build in WPF in the existing program.

After a couple of changes, the current error keeps coming:
Error XS1558 'Functions' does not have a suitable static Start method
Functions is one of 2 programs which only contains functions. It SHOULD not have a start method! I tried to avoid this by adding some namespace, class and/or start code but the only result was parser errors.

Eventually, I copied the functions into the other program with functions which did not seem to give an error and removed the original functions.prg. Same error, this time again without a line number. After an external file content check on "Functions" I removed every reference to it (but these were only in *.vi* files, so for Vide and as I use VS it did not make a difference.

What does this message mean? Where does it come from and from where does it get 'Functions' while this is nowhere to be found anymore?

Did I tell you I hate Visual Studio? These kind of puzzling errors simply do not occur in the repo based Visual Objects code where you can basically put any method or class anywhere, move it and it just works. In VS, just a space in the wrong place keeps you busy for hours with cryptic error messages.

Dick

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 2 weeks ago #2

Hi Dick,

This looks like an unlucky situation, "Functions" is a special name used by the compiler for the class that holds the functions that you declare in your code (functions are included as methods of this class) and there's a naming conflict with your name for the app. Try renaming your app/project to "Funcs", instead of "Functions", does it work ok now?

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 2 weeks ago #3

Hello Chris,

I already deleted functions.prg and the error persisted. The other program with functions is called Functions_MyClient.prg and renaming that to Funcs_MyClient.prg does not solve the issue.

It did not give this error earlier. Only when we started with adding a WPF screen we eventually ended up with this error.

Dick

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 2 weeks ago #4

Hi Dick,

Maybe you just have not included a FUNCTION Start() then?

If that's not the case, can you please zip and send me the solution to have a look?

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 2 weeks ago #5

  • wriedmann
  • wriedmann's Avatar
  • Away
  • Posts: 1406
  • Karma: 6
Hi Dick,

you need a typed Start() function.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 2 weeks ago #6

I have no function Start in my other X# solution for functions.prg because it is not the main program. So I don't expect the error here.

But to be sure I didn't miss something I started a new program, copied all files, included all DLL's etc. It worked. I entered the original WPF content and unfortunately I am back with my original error Partial declarations of '{0}' must not specify different base classes.

I clicked until the point I have only the basic XAML code again but still it doesn't work.

Chris, I will send my project. You have often seen the problem in a very short time before, hopefully you'll see it now as well.

Dick

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 2 weeks ago #7

  • wriedmann
  • wriedmann's Avatar
  • Away
  • Posts: 1406
  • Karma: 6
Hi Dick,

then your application needs to be defined as library, not as Windows executable.

An application needs a start() function, a library does not.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 2 weeks ago #8

Hello Wolfgang,

then your application needs to be defined as library, not as Windows executable.
An application needs a start() function, a library does not.


No, that's not the problem. The application has the whole startup in the WPF generated code behind like the IntializeComponent(). Apart from that a few other prg's are included with functions or other methods. This method with functions does not need a startup method; that works exactly the same way in another WPF X# program of mine.

Currently Chris has the rebuilt WPF solution with the "Partial declarations of ... must not specify different base classes" error & the Functions included. If he knows what causes the problem there the other one hopefully stays away. And maybe even the original 'rebuilt' VO window program will work then.

Dick

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 2 weeks ago #9

Hi Dick,

Thanks for sending the code and sorry for the delay.

Turns out this is a small compiler bug, the same partial class is defined in the (auto generated) .g.prg file with a clause "INHERIT System.Windows.Window" while in your .prg you are using "INHERIT Window". Practically those two are the same, but seems the compiler could not figure this out, while it probably should.

Anyway, fortunately the fix is easy, change your inherit clause to the same as in the .g.prg file (INHERIT System.Windows.Window), or simply completely remove the INHERIT clause, the compiler will now see only the other one, will use it and there will be no conflicts.

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 1 week ago #10

Chris,

I don't think this is a compiler bug.
The problem with the "INHERIT Window" is that there is also a class Window in the GUI library that is included. And since the compiler option "Enable Implicit Namespace Lookup" is enabled then the compiler will find the Vulcan.VO.Window class for this INHERIT clause.
This of course is not correct.
The only thing that the compiler could have done better is probably reporting that there is ambiguity here.

Robert

Chris Pyrgas wrote: Turns out this is a small compiler bug, the same partial class is defined in the (auto generated) .g.prg file with a clause "INHERIT System.Windows.Window" while in your .prg you are using "INHERIT Window". Practically those two are the same, but seems the compiler could not figure this out, while it probably should.

Anyway, fortunately the fix is easy, change your inherit clause to the same as in the .g.prg file (INHERIT System.Windows.Window), or simply completely remove the INHERIT clause, the compiler will now see only the other one, will use it and there will be no conflicts.

Chris

XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 1 week ago #11

Robert,

Oops, I didn't notice the references to the SDK classes! Good point :)

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 1 week ago #12

Hello Chris, Robert,

That solved this error, thanks. I think a change in the compiler message would help indeed, but even adapting the compiler error in the help would work for me.

However, unfortunately, I still can not get the program working. I've spent considerable time and started over a dozen times (also every time trying to get rid of the unwanted WpfApplication1 tags. In a a couple of instances I ended up with a Xaml designed in which I could not click or drag controls into. I guess I already wrote you that I hate Visual Studio :evil:? )

Anyhow: after a while I could compile the project I mailed Friday but nothing happened when I started it. In the debug mode I found that it didn't even get beyond app:Run() where it gives an XamlParseException error. See picture.

I thought it could be that I included references to Vulcan 4 DLL's while I also have a ADS DLL included which is based on Vulcan 3. I removed the references and added a reference to all Vulcan DLL's in C:\Program Files (x86)\Vulcan.NET 3.0\Redist\Assemblies\v4.0\. This had another nice effect: Visual Studio quickly came with a box "The operation you requested is taking longer..." (See picture). Te first time I had to use Task manager to kill VS. As it's VS I decided to give it some more time the 2nd try but after an hour it still showed this message . However: this time some clicking gave the error message as in the attached picture.

I removed the Vulcan references starting from the backup project. I added a reference to only the few Vulcan 3.0 DLL's the program needs to compile, this time it compiled, but it still doesn't get beyond the app:Run(). As I built this a a WPF X# program from scratch I am out of ideas how I could get this working otherwise, especially since I have 1 working X# WPF application and I don't see any real differences.

Except for some globals I added as a temporary solution + 2 included prg's with functions, I have not even added the converted VO code yet.

Can I ask you Chris to have another quick look as to why this project fails to start? I have uploaded the project in the same link as I mailed you Friday. Hopefully you have an idea quickly.

Dick

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 1 week ago #13

(and for going back to the original question):
If I continue with a working and starting WPF application, the Vulcan DLL's included but no converted VO code yet, the error immediately returns when I change the dialect from Core to Vulcan.

Error XS1558 'Functions' does not have a suitable static Start method

Note that I did NOT yet include the prg called Function.prg with function it it.
This error is the direct result of changing Core to Vulcan. I've set the language settings equal to those in my working # program (Allow Unsafe code, Enable implicit Namespace lookup, Implicit signed/unsigned conversions and Treat missing types as usual) to true but this error won't disappear.

Does this give more info?

Note that this question is from a different version of the project than the question below. But I'd say in the end both should lead to a working X# WPF program....

Dick

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 1 week ago #14

Hi Dick,

Found the problem, it was due to the Project Properties\Language page\"Implicit CLIPPER calling convention" compiler option. Set that to False and it should work fine.

I know, you will say that you did not have such strange problems in VO, but that's because VO's compiler does not have many of the features that .Net compiles have, like method overloading which is the culprit in this case. Also it does not help that WPF is designed to create and use "ghost" .prg files, which are not visible in the solution explorer, so it is hard to debug such issues.

Anyway, the problem is caused because a method (InitializeComponent()) that the designer created in such a file (KleijnOCRScan.g.prg) has no parameters, and the above compiler option gives such methods CLIPPER calling convention, for compatibility with VO code. The system expects a STRICT method though, thus the runtime error.

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 1 week ago #15

Hi Dick,

About the problem with Start(), it could be due to the same reason. Try setting the same option to False, does it fix the compiler error? If it doesn't, do you have defined a FUNCTION Start() yourself in that project? If yes, how exactly have you defined it?

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 1 week ago #16

Hello Chris,

YES, that fixes it! I thought I already had created a version with minimal compatibility language settings to true but apparently that was only with the 2nd problem. Although this is not important for the project, which Jelle can continue Monday thanks to you even replying in the weekend (!!) I will certainly double check the settings there too (I've got about a dozen copies of the project in various stages now) and should this be another issue I may send you a copy once again.

In return I'll promise to create a chapter in "Wolfgangs Wiki" for anyone who needs to do the same.

I know, you will say that you did not have such strange problems in VO, but that's because VO's compiler does not have many of the features that .Net compiles have, like method overloading which is the culprit in this case. Also it does not help that WPF is designed to create and use "ghost" .prg files, which are not visible in the solution explorer, so it is hard to debug such issues.


Actually yes and no. I fully realize that creating a language which needs to be compatible with >20 year old VO code is a hell of a job and these kind of problems occur now and then.
I do however also see again and again that the design of VS and the compiler, lets put it friendly, leaves much to be desired. The ghost .prg/.cs files are terrible and makes understanding how the program works almost impossible. And the ambagious references, where it all started with, are present as well in C# where this backward compatibility wasn't an issue. Example: you enter

string cDestFile = Path.Combine(cDestDir, cNewName);

and the compiler begins to complain that Path is ambagious because some idiot forgot to check that Path already existed in System.IO when he chose the same name for System.Windows.Shapes so you must use string cDestFile = System.IO.Path.Combine(cDestDir, cNewName);

VS and C# are all lousy & lazy designed.

Anyhow thanks again; I'll be back with info about the Start method error soon.

Dick

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 1 week ago #17

Hi Dick,

I agree about the ghost code files in WPF, I also don't understand what they were thinking what they designed this (and a few other things) this way.

About the "Path" thing, "problem" is that there are literally millions of classes that you can use in any .Net language, either system ones or from 3rd party libraries, so it is inevitable that there will be naming conflicts. At least in .Net we have the concept of namespaces, so you can fully qualify the class name and problem solved. I am wondering if there is any solution at all in VO, when you try to use 2 libraries that have class with the same name...

In any case, glad you have it working now!

Chris

ps. it's not just a weekend, for us down here it's also the orthodox Easter weekend!
:):):)
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 1 week ago #18

  • wriedmann
  • wriedmann's Avatar
  • Away
  • Posts: 1406
  • Karma: 6
Hi Dick, hi Chris,

as you both know, I'm far from liking Visual Studio <g>.

WPF is very wonderful and extremely powerful, and that makes it hard to master. With Visual Studio Microsoft has tried to let if master by point-and-click programmers, and it took years and several versions until the Visual Studio XAML editor finally worked.
Of course, to make work such a complex beast as WPF in a apparently easy-to-use tool requires many compromises and includes also hidden details (like the .g.prg files needed for the X#/C# compiler to "know" what whas defined in the XAML file).

I can assure you that I don't like at all the way Microsoft has designed the XAML integration in Visual Studio, but I think that this was not an easy job, and I cannot immagine another one without these hidden files.

If you look around you will find many material about WPF, and many incredible complex XAML code samples, and therefore my conclusion is that basically Microsoft has selected the right way for its development tool.

Anyway, there are much easier ways to build WPF code if you look behind the scenes and you are willing to write some source code (that can then be used also in XAML).

Hopefully, my two sessions at the Cologne conference will give some new insights how you can simplify and power WPF applications (I have finished the last sample for the second session yesterday....).

Wolfgang

P.S: I'm planning to write a standalone WPF window editor - an editor that writes X# code (or C# code) and stores the windows definitions in text files. This editor will not be a two-way editor like the one in Visual Studio, but a one-way editor like the one in Visual Objects, and it will let you use your own control and window classes as a easily as the VO Window Editor and the XIDE window editor. And it will be open source, in the hope to beocme better that way
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Last edit: by wriedmann.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 1 week ago #19

Hi Wolfgang,

Really looking forward to have a look at your editor, when you have some first versions of it!

But at least regarding the ghost files, I'm pretty sure those could had easily been made "public", just like the files generated by the WinForms editor, but apparently the WPD team decided otherwise...

Chris
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

Error XS1558 'Functions' does not have a suitable static Start method 11 months 1 week ago #20

  • wriedmann
  • wriedmann's Avatar
  • Away
  • Posts: 1406
  • Karma: 6
Hi Chris,

you can be sure to see the first working prototypes as I will need your help to integrate into XIDE....
But unfortunately I have to do a few other projects before....

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

  • Page:
  • 1