Strange error 0118 in comment <sic> & differences XIDE vs VS
Posted: Sat Feb 11, 2017 9:38 pm
Following Phil's advice i got me via nuget "EasyHttp" library from github.
Made a new X# app in Xide, added the references to the two dlls involved.
Then:
That code is partially transferred from minimal sample from the lib, hence the commented lines.
The strange thing is: this very code produces on F9 a:
Compilation failed (1 error)
error XS0118: 'customer' is a variable but is used like a type 16,38 Start.prg EasyHttp
Line 16 is the empty line behind the closing RETURN.
Why even "reads" the compiler the commented lines?
If i remove the commented lines, it compiles.
Unfortunately, further on, Xide fails at runtime with "System.TypeLoadException: Type "EasyHttp.Http.HttpClient" in Assembly "EasyHttp, Version=0.0.0.0, Culture=neural, PublicKeyToken=null" couldn't be loaded" (Copy to bin is set, the dlls are there...).
This made me "copy" the app in VS2015, where this error does not happen. Looking further, the template for a console app in VS has about 6 references more, so to check this out, i added them to my Xide-app, but to no avail...
Made a new X# app in Xide, added the references to the two dlls involved.
Then:
Code: Select all
USING EasyHttp
USING EasyHttp.Http
FUNCTION Start( ) AS VOID
System.Console.WriteLine("Hello x#!")
GetFromUrl()
RETURN
FUNCTION GetFromUrl() AS VOID
LOCAL http := HttpClient{} AS HttpClient
http:Get("drei-f.de")
// http:Request:Accept := HttpContentTypes.ApplicationJson
// VAR response := http.Get("url")
// VAR customer := response.StaticBody<Customer>()
// Console.WriteLine("Name: {0}", customer.Name)
RETURN
The strange thing is: this very code produces on F9 a:
Compilation failed (1 error)
error XS0118: 'customer' is a variable but is used like a type 16,38 Start.prg EasyHttp
Line 16 is the empty line behind the closing RETURN.
Why even "reads" the compiler the commented lines?
If i remove the commented lines, it compiles.
Unfortunately, further on, Xide fails at runtime with "System.TypeLoadException: Type "EasyHttp.Http.HttpClient" in Assembly "EasyHttp, Version=0.0.0.0, Culture=neural, PublicKeyToken=null" couldn't be loaded" (Copy to bin is set, the dlls are there...).
This made me "copy" the app in VS2015, where this error does not happen. Looking further, the template for a console app in VS has about 6 references more, so to check this out, i added them to my Xide-app, but to no avail...