Error XS0656 Missing compiler required member

This forum is meant for questions about the Visual FoxPro Language support in X#.

Post Reply
Anonymous

Error XS0656 Missing compiler required member

Post by Anonymous »

What is causing this error?

It's related to the use of Text/EndText in the running code.
Error XS0656 Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create' VPF Xsharp test app 1 H:WorkReposXSharp ProjectsVPF Xsharp test app 1VPF Xsharp test app 1SqlBoBase.prg 50
2020-04-26 19_51_06-VPF Xsharp test app 1 - Microsoft Visual Studio.png
2020-04-26 19_51_06-VPF Xsharp test app 1 - Microsoft Visual Studio.png (37.46 KiB) Viewed 609 times
FoxProMatt

Error XS0656 Missing compiler required member

Post by FoxProMatt »

Okay, I found the answer in another thread here be searching for "XS0656".

The answer is that you must add a reference to Microsoft.CSharp.dll into your project.

Please add this info to the Help File for the Text/EndText function in the docs: https://www.xsharp.eu/help/command_text.html
The attachment 35e092f562a1acc0be993bf318536333 is no longer available
2020-04-26 19_56_26-VPF Xsharp test app 1 (Running) - Microsoft Visual Studio.png
2020-04-26 19_56_26-VPF Xsharp test app 1 (Running) - Microsoft Visual Studio.png (13.02 KiB) Viewed 609 times
User avatar
Chris
Posts: 4978
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Error XS0656 Missing compiler required member

Post by Chris »

Hi Matt,

TEXT/ENDTEXT does not require this reference, at least not in any case I am aware of. Are you using DYNAMIC vars elsewhere in your code? Those indeed need this reference.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4558
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Error XS0656 Missing compiler required member

Post by robert »

Matt,

I suspect that this is caused by a setting at the project level, just like your ticket #373 on Github.
Can you mail us an example ?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
FoxProMatt

Error XS0656 Missing compiler required member

Post by FoxProMatt »

I have explored this situation further...

In my code there is a Class with public properties, and in the Text/EndText, I had referred to a "This.PkField" class property (wrong name) but the actual property is named "cPkField" (c prefix at front).

Well, because the Text/EndText referred to a bad property name reference to <<This.PkField>>, Visual studio gives a Warning:
"Warning XS9094 Type 'TestClass' does not have a member 'PkField'. This gets resolved to a late bound call to its method 'NoIVarGet'
BUT.. This also causes a Compiler error XS0656 stating "Error XS0656 Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'"


The Warning finally caught my eye and helped me see what the problem is, because I was first more worried because of the compiler error.

So when I added the DLL it made the compiler happy, but the Warning about missing property also went away and I thought everything was good until I got a run-time error complaining that "''TestClass' does not contain a definition for 'PkField''

Bottom line is I had a bad property reference in my code, and because I am still learning this stuff, it took me a while to figure out from the help that Visual Studio was giving me.

The bad thing about this case is that with the DLL added to the project, you loose all the help that the compiler can give you (from Warnings), and you can get run-time errors because you are not told that you have bad code.


Here is the code that will demo the error.

Code: Select all

Using System
Using System.Collections.Generic
Using System.Linq
Using System.Text

Using XSharp.Core
Using XSharp.VFP
Using XSharp.RT
Using XSharp.RDD



FUNCTION Start() As Void Strict
	
	Var oTest = TestClass{}
	
	oTest.DemoCsharpDllRequiredError()
		
	Return
	
END FUNCTION
	

*======================================================================
Define Class TestClass As Custom
	
	Public cTable = "Customers"
	Public cPkField = "ID"
	
	*---------------------------------------------------------------------------------
	Function DemoCsharpDllRequiredError(uValue)
  
		Local lcSql

		Text To lcSql Textmerge Noshow
			Select * From <<This.cTable>> Where <<This.PkField>> = <<uValue>>
		Endtext
  
		? lcSql
	
		Wait
		
		Return
  
	End Function
  
End Define


2020-04-27 09_35_14-VPF Xsharp test app 2 - Microsoft Visual Studio.png
2020-04-27 09_35_14-VPF Xsharp test app 2 - Microsoft Visual Studio.png (118.84 KiB) Viewed 609 times
User avatar
robert
Posts: 4558
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Error XS0656 Missing compiler required member

Post by robert »

Matt,
As interesting all of this is, it still does not explain the error.
Did you have the "enable late binding" compiler option selected ?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
FoxProMatt

Error XS0656 Missing compiler required member

Post by FoxProMatt »

At first I did not have Allow Late Bind enabled...

But then I enabled it, and now I don't get any compiler errors or even any run-time errors.

So this is REALLY BAD...

I have code that references a non-existing property on an object reference, and at run-time it does not even give an error and Text/EndText generated a text string while totally skipping over the referenced (bad/missing) property. This can certainly lead to big problems in a running app.

See below I attached a full Solution to demonstrate this problem.
2020-04-27 10_10_19-VPF Xsharp test app 2 (Running) - Microsoft Visual Studio.png
2020-04-27 10_10_19-VPF Xsharp test app 2 (Running) - Microsoft Visual Studio.png (83.12 KiB) Viewed 609 times
Attachments
VPF Xsharp test app 2.7z
(575.62 KiB) Downloaded 71 times
User avatar
robert
Posts: 4558
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Error XS0656 Missing compiler required member

Post by robert »

Matt,
You should have seen a runtime error.
I'll check why that does not happen.
And w.r.t the compile time errors:
I'll discuss with the guys what we can do. Maybe can change the compiler to allow undeclared variables for certain class and their subclasses, such as the Empty class, but still generate compiler errors/warnings for other classes.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply