xsharp.eu • Why this error, from a simple test function?
Page 1 of 1

Why this error, from a simple test function?

Posted: Fri Sep 01, 2017 10:40 pm
by xnetExplorer
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)

Code: Select all

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#.

Why this error, from a simple test function?

Posted: Sat Sep 02, 2017 3:28 am
by Chris
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 AssembliesMicrosoftFramework.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.

Why this error, from a simple test function?

Posted: Sat Sep 02, 2017 4:31 am
by wriedmann
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

Why this error, from a simple test function?

Posted: Sun Sep 03, 2017 1:14 pm
by xnetExplorer
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:

Code: Select all

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)

Why this error, from a simple test function?

Posted: Sun Sep 03, 2017 1:20 pm
by wriedmann
Hi Dan,

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

If you write

Code: Select all

FUNCTION Start AS VOID
	VAR s_Test := "Test"
	? s_Test
	
	RETURN
it works (at least on my machine) - compiles and runs.

Wolfgang

Why this error, from a simple test function?

Posted: Sun Sep 03, 2017 1:24 pm
by robert
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

Why this error, from a simple test function?

Posted: Mon Sep 04, 2017 8:38 pm
by xnetExplorer
Got it, thanks W.R. and Robert.

Why this error, from a simple test function?

Posted: Thu Sep 07, 2017 3:41 pm
by xnetExplorer
Hi Chris,

The .net versions are 3.5 and 4.0.

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

https://www.xsharp.eu/itm-downloads?fol ... 252FSetups

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


Regards,

DC

Why this error, from a simple test function?

Posted: Thu Sep 07, 2017 4:34 pm
by Chris
Hi Dan,

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

https://www.microsoft.com/en-us/downloa ... x?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 (https://www.xsharp.eu/store). But the public version is just fine for your first steps/tests in X#.

Chris

Why this error, from a simple test function?

Posted: Thu Sep 07, 2017 4:37 pm
by xnetExplorer
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.