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 (118.84 KiB) Viewed 608 times