fbpx

Why this error, from a simple test function?

More
1 year 4 months ago #1 by Dan Campbell
Why this error, from a simple test function? was created by Dan Campbell
Hi,

First trial, of XSharp and XIDE.

I'm getting a compiler error

Compiler has returned exit code -532462766

Unhandled Exception: System.MissingMethodException: Method not found: '!!0[] System.Array.Empty()'.
at LanguageService.CodeAnalysis.XSharp.CommandLine.Program.Main(String[] args)

FUNCTION Test AS VOID

VAR s_Test := "Test"
? today
 
 
RETURN


I took out a Compiler dialect parameter

/dialect: Harbour

, and left it at the default, which I assume is X#.

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

More
1 year 4 months ago #2 by Chris Pyrgas
Replied by Chris Pyrgas on topic Why this error, from a simple test function?
Hi Dan,

It looks like a .Net version problem, the compiler tries to use something that's not available in the system dlls of your machine. Please check this folder:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework

It should list all the .Net versions of your machine, please tell us that list.

Chris

ps. for using the Today() function, you will need to include the parentheses as well.

XSharp Development Team
chris(at)xsharp.eu

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

More
1 year 4 months ago #3 by Wolfgang Riedmann
Replied by Wolfgang Riedmann on topic Why this error, from a simple test function?
Hi Chris, hi Dan,

I have seen such an error (only at runtime, not from the compiler) only two times:
- one time on a Windows XP machine
- the other time on a Windows 8 machine (not 8.1)

So I suspect there is effectively an outdated .NET Framework version on the machine.

What ist the OS version?

Wolfgang

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

More
1 year 4 months ago - 1 year 4 months ago #4 by Dan Campbell
Replied by Dan Campbell on topic Why this error, from a simple test function?
Hi Chris and Wolfgang,

Ok, I'll check that PC on Tuesday. It's Windows 7 Pro.

I just tried the following code, on a Windows 8.1 laptop:
FUNCTION test AS VOID
	VAR s_Test := "Test"
	? s_Test
	
	RETURN

(Note that the today variable, should have been s_Test)

, and received the following error:

error XS1558: 'Functions' does not have a suitable static Start method
Compilation failed (1 error)
Last edit: 1 year 4 months ago by Dan Campbell.

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

More
1 year 4 months ago - 1 year 4 months ago #5 by Wolfgang Riedmann
Replied by Wolfgang Riedmann on topic Why this error, from a simple test function?
Hi Dan,

you need a Start() function as entry point in your application.

If you write
FUNCTION Start AS VOID
	VAR s_Test := "Test"
	? s_Test
	
	RETURN

it works (at least on my machine) - compiles and runs.

Wolfgang
Last edit: 1 year 4 months ago by Wolfgang Riedmann.

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

More
1 year 4 months ago - 1 year 4 months ago #6 by Robert van der Hulst
Replied by Robert van der Hulst on topic Why this error, from a simple test function?
Dan,
That message is not really a compiler error:

If you create a standalone Exe you must have a Start() function. If you compile to a DLL that is not needed.
In C# and C++ you would have to create a main() function.

Robert

XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.
Last edit: 1 year 4 months ago by Robert van der Hulst.

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

More
1 year 4 months ago #7 by Dan Campbell
Replied by Dan Campbell on topic Why this error, from a simple test function?
Got it, thanks W.R. and Robert.

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

More
1 year 4 months ago #8 by Dan Campbell
Replied by Dan Campbell on topic Why this error, from a simple test function?
Hi Chris,

The .net versions are 3.5 and 4.0.

By the way, where are the new XSharp versions? The one at

www.xsharp.info/itm-downloads?folder=general%252FSetups

is from July 10th. That's the one that I have.


Regards,

DC

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

More
1 year 4 months ago #9 by Chris Pyrgas
Replied by Chris Pyrgas on topic Why this error, from a simple test function?
Hi Dan,

OK, that's the problem, you need to install a newer .Net Framework version, at least 4.6.1:

www.microsoft.com/en-us/download/details.aspx?id=49982

Maybe we should add a check in the compiler to show an error message when there's an old version installed only.

About X# versions, the one you have is the latest public version, newer ones are released to FOX subscribers ( www.xsharp.info/store ). But the public version is just fine for your first steps/tests in X#.

Chris

XSharp Development Team
chris(at)xsharp.eu

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

More
1 year 4 months ago #10 by Dan Campbell
Replied by Dan Campbell on topic Why this error, from a simple test function?
Ok, thanks. I'm actually a subscriber as of this morning, but it's just taking a while for the payment to be processed.

Thanks Chris, will download the newer .net version.

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