fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC:

Xporting an Internet Server based program: Object reference not set.. 04 Sep 2019 18:26 #10565

  • ic2's Avatar

  • ic2

  • Topic Author


  • Posts: 749
  • We are Xporting an Internet Server based program. There is no VO.dll for that SDK so I included a new project where I plan to add any missing code from the SDK source of VO. Not sure if this is the right approach.

    Now there's something odd. I called the project SDK and I added Class HTTPCGIContext Inherit HTTPContextAbstract and Class HTTPContextAbstract and within the latter Method GetParamValue(cParam As String, n As Dword, a As Array, lNil As Logic) As String Pascal Class HTTPContextAbstract. When I rebuild that project the SDK.DLL is created successfully.

    Now I rebuild the whole project. This gives the error:
    Severity Code Description Project File Line Source Suppression State Tool
    Error XS0246 The type or namespace name 'HTTPCGIContext' could not be found (are you missing a using directive or an assembly reference?)
    Ok, makes sense, the SDK project was not included in one of the projects inheriting from HTTPCGIContext from the SDK project. So I select Add Reference and double click on SDK (from tab Projects).

    I then get an error box: Object reference not set to an instance of an object.

    How can I solve this?

    Dick

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

    Last edit: by ic2.

    Xporting an Internet Server based program: Object reference not set.. 04 Sep 2019 18:35 #10566

  • Chris's Avatar

  • Chris


  • Posts: 2110
  • Hi Dick,

    Which build are you using? There was a similar problem some time ago but was fixed in the last couple builds.
    XSharp Development Team
    chris(at)xsharp.eu

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

    Xporting an Internet Server based program: Object reference not set.. 04 Sep 2019 19:36 #10567

  • ic2's Avatar

  • ic2

  • Topic Author


  • Posts: 749
  • Hello Chris,


    That is the XSharpSetup2RC2Fox to which I reverted today (June 14)

    Dick

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

    Xporting an Internet Server based program: Object reference not set.. 04 Sep 2019 20:23 #10568

  • Chris's Avatar

  • Chris


  • Posts: 2110
  • Hi Dick,

    I am pretty sure the problem was fixed after that. You will need to use the later builds anwyay at some point, please answer my questions about the issue you have in the latest one, so we can try and track down the problem.
    XSharp Development Team
    chris(at)xsharp.eu

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

    Xporting an Internet Server based program: Object reference not set.. 06 Sep 2019 10:02 #10597

  • ic2's Avatar

  • ic2

  • Topic Author


  • Posts: 749
  • Helle Chris,

    It is fixed indeed in the current run (and I am sure it must have worked in most older versions too because including libs/projects a pretty basic thing :P

    Kees tried it on his system with the latest release but until the issue with the ADS dbf write is solved I will have to stick to the RC2 and pause the Xporting work .

    Dick

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

    Xporting an Internet Server based program: Object reference not set.. 06 Sep 2019 10:30 #10599

  • wriedmann's Avatar

  • wriedmann


  • Posts: 2336
  • Hi Dick,

    do you have tried to xport the Internet Server SDK with the sources you have from VO?
    I have tried it now as it should work, but it seems that X# does not accept type pointers to functions like this here:
    member pSetHeader as SetHeader ptr
    where
    function SetHeader(pfc as _WINHTTP_FILTER_CONTEXT, lpszName as psz,lpszValue as psz) as logic pascal
    	return .T.
    But I'm sure Chris or Robert can help here.

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    Xporting an Internet Server based program: Object reference not set.. 06 Sep 2019 11:19 #10600

  • ic2's Avatar

  • ic2

  • Topic Author


  • Posts: 749
  • Hello Wolfgang,

    Basically what we want to do is to modernize our CGI .exe Webprogram to eventually a ASPX based X#/C# DLL. First step is to see if the current code can convert. This allows us just to remove whatever is in the Internet SDK. For example: MySQL access relies on ancient ODBC and it has proven to be a problem to get that configured when running the program on another webserver. Then we will also replace other methods like GetParamValue. For all this there are much better .Net alternatives. But we want to make sure that we can compile the rest of the code and for that we add the absolute minimum of Internet SDK code in a separate project . If it compiles to run we will replace every single call and can then remove this SDK methods and classes again.

    Dick

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

    Xporting an Internet Server based program: Object reference not set.. 06 Sep 2019 11:34 #10601

  • wriedmann's Avatar

  • wriedmann


  • Posts: 2336
  • Hi Dick,

    this was only a thought.
    Initially, in my migrations I had planned to change such things, but in the meantime I have changed my plans.
    I will try to maintain the VO code whenever possible and rewrite only the parts that I need to change.
    Old technolgies will only be replaced my newer ones when the migration is complete and the X# version of my software is running.
    Otherwise the migration may be too much work.....
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    Xporting an Internet Server based program: Object reference not set.. 22 Jan 2020 16:44 #12854

  • KeesIC2's Avatar

  • KeesIC2


  • Posts: 12
  • wriedmann wrote: it seems that X# does not accept type pointers to functions like this here:

    member pSetHeader as SetHeader ptr
    where
    function SetHeader(pfc as _WINHTTP_FILTER_CONTEXT, lpszName as psz,lpszValue as psz) as logic pascal
    	return .T.


    We are having the same problem when using the VO Internet Server API SDK (imported with the VO Xporter). There are 13 "Member line" errors. Is there a solution that we can apply or is it something unfinished in X#?

    Kees.

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

    Last edit: by KeesIC2.

    Xporting an Internet Server based program: Object reference not set.. 22 Jan 2020 20:48 #12861

  • Chris's Avatar

  • Chris


  • Posts: 2110
  • Hi Kees,

    KeesIC2 wrote:

    wriedmann wrote: it seems that X# does not accept type pointers to functions like this here:

    member pSetHeader as SetHeader ptr
    where
    function SetHeader(pfc as _WINHTTP_FILTER_CONTEXT, lpszName as psz,lpszValue as psz) as logic pascal
    	return .T.


    We are having the same problem when using the VO Internet Server API SDK (imported with the VO Xporter). There are 13 "Member line" errors. Is there a solution that we can apply or is it something unfinished in X#?

    Kees.


    What is the exact error message?

    Can you please post (complete) sample code showing this problem?
    XSharp Development Team
    chris(at)xsharp.eu

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

    Xporting an Internet Server based program: Object reference not set.. 22 Jan 2020 21:18 #12862

  • wriedmann's Avatar

  • wriedmann


  • Posts: 2336
  • Hi Chris,
    the message is the following:
    error XS0246: The type or namespace name 'GetHeader' could not be found (are you missing a using directive or an assembly reference?)	261,23	ISAPIDefine.prg	VOInternetServer
    on this line of code:
    member pGetHeader as GetHeader ptr
    I've taken the VO Internet Server SDK and xported it to X#.
    Please find the zipped XIDE Export File.
    Wolfgang

    File Attachment:

    File Name: VOInternetServer.zip
    File Size:12 KB
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it
    Attachments:

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

    Xporting an Internet Server based program: Object reference not set.. 22 Jan 2020 21:19 #12863

  • wriedmann's Avatar

  • wriedmann


  • Posts: 2336
  • Hi Chris,
    maybe the function pointers are to replace with delegates....
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    Xporting an Internet Server based program: Object reference not set.. 22 Jan 2020 23:53 #12865

  • Chris's Avatar

  • Chris


  • Posts: 2110
  • Hi Wolfgang,

    Yeah, normally you'd need to use delegates and then pointers derived from them,but this structure is being filled by windows, not by the user, isn't that right? So you do not have control on how you create it.

    I think it should be still possible to use the pointers returned and even call the functions contained in them through the pcall/ccall mechanism and actually typed function pointers are already supported in LOCALs (with the /vo6 compiler option enabled), so probably they can be supported in VOSTRUCTs as well, but I think all this will become a big mess, isn't it much better just using the standard .Net internet classes instead, even for ported apps?

    But for a quick answer if you really want to compile this library, if you are not actually using the function pointers, you can simply change them to simple AS PTR. Do you have some small code actually using those structures?
    XSharp Development Team
    chris(at)xsharp.eu

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

    Xporting an Internet Server based program: Object reference not set.. 23 Jan 2020 08:38 #12874

  • wriedmann's Avatar

  • wriedmann


  • Posts: 2336
  • Hi Chris,
    this library is a part of the VO SDK, and even if I don't use this, there are several people that used it and have asked also in the past to move it to X#.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    Xporting an Internet Server based program: Object reference not set.. 23 Jan 2020 08:59 #12876

  • robert's Avatar

  • robert


  • Posts: 1846
  • Wolfgang,

    We'll have a look at the library.
    But it will not be easy.
    What are you using this for?
    - CGI apps
    - ISAPI Extension DLL
    - ISAPI Filter DLL
    - ASP Component DLL

    Robert
    XSharp Development Team
    The Netherlands

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

    Xporting an Internet Server based program: Object reference not set.. 23 Jan 2020 09:09 #12877

  • wriedmann's Avatar

  • wriedmann


  • Posts: 2336
  • Hi Robert,
    personally I don't use that. But I know several people that uses CGI apps, and I think Dick is using the same.
    So this would be the most important.
    If others are used, people will ask here, I hope.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    Xporting an Internet Server based program: Object reference not set.. 23 Jan 2020 17:26 #12886

  • KeesIC2's Avatar

  • KeesIC2


  • Posts: 12
  • Hi All,

    Thank you for the replies. Yes, we have several CGI applications that we would like to transfer to X#. I would be more than happy to use standard .NET internet classes, but some explanation or help would be very welcome. From the VO class we only use this:

    CLASS HTTPCGIContext, methods:
    GetParamValue
    GetParams
    Write
    HttpHeader
    Close
    ReadCookies
    GetCookieValue
    SetCookie
    and CLASS HttpCookie

    If there are corresponding .NET calls then maybe it will not be too difficult to use those?

    Kees.

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

    Last edit: by KeesIC2.

    Xporting an Internet Server based program: Object reference not set.. 23 Jan 2020 21:43 #12891

  • robert's Avatar

  • robert


  • Posts: 1846
  • Kees,
    I will see what I can do.

    Robert
    XSharp Development Team
    The Netherlands

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

    Xporting an Internet Server based program: Object reference not set.. 18 Feb 2020 15:51 #13304

  • KeesIC2's Avatar

  • KeesIC2


  • Posts: 12
  • With help from Robert I managed to Xport our CGI application and successfully build it in X# without any errors or even warnings. Now I have the situation that the application built in VO does work (and has worked for many years already), but if I copy all files in the X# release folder including the new executable to the website, the web server does not even try to execute it but immediately displays a download window. The X# exe has the same name as the VO exe so executable rights etc. have all been set. What puzzles me is why the web server does not even try to execute it. I should think that once the web server is set up correctly, which it is otherwise the VO version would not work, it will execute anything with the correct name. Many things can go wrong after execution starts of course, but we don't even get to that point. Any ideas on how to explain this (or even better: fix it) are very welcome!

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

    Xporting an Internet Server based program: Object reference not set.. 18 Feb 2020 16:40 #13306

  • SHirsch's Avatar

  • SHirsch


  • Posts: 170
  • Hi Kees,

    here is a Test class for testing CGI processes. I use this to test php implementation via CGI/FastCGI in my WebServer. Just replace Filename with your exe file and add your required EnvironmentVariables.
    Than console output should help.
    FUNCTION Start( ) AS VOID
    	System.Console.WriteLine("Hello x#!")
    
    	VAR test := CgiTest{} 
    	test:CallCgi()
    RETURN
    
    CLASS CgiTest
    PRIVATE _phpOutput AS STRING
    METHOD CallCgi() AS VOID   
        TRY
            VAR  p := System.Diagnostics.Process{}
            p:StartInfo:FileName := "f:\Temp\php-7.4\php-cgi.exe"  //Replace with your file
            p:StartInfo:CreateNoWindow := TRUE
            p:StartInfo:UseShellExecute := FALSE       
            p:StartInfo:RedirectStandardInput := TRUE
            p:StartInfo:RedirectStandardOutput := TRUE   
            p:StartInfo:RedirectStandardError  := TRUE  
            p:StartInfo:StandardOutputEncoding := System.Text.Encoding.UTF8
            
            VAR evList := Dictionary<STRING, STRING>{}
            
            p:StartInfo:EnvironmentVariables:Add("SCRIPT_FILENAME", "f:\Temp\php-7.4\Wiki\Doku.php")  //Change an add you variables
            p:OutputDataReceived += phpOutputReceived  
            p:Start()
            
            p:BeginOutputReadLine()  
            
            IF (!p:WaitForExit(10000))
               p:Kill()
            ENDIF                                    
            
                     
            VAR err := p:StandardError:ReadToEnd()  
            
            
            Console.WriteLine("received: "+SELF:_phpOutput)
            Console.WriteLine("error: "+err)
        CATCH ex AS Exception
            Console.WriteLine(ex:ToString())
        END TRY
    RETURN         
    METHOD phpOutputReceived(sender AS OBJECT , e AS System.Diagnostics.DataReceivedEventArgs) AS VOID
        SELF:_phpOutput += e:Data+e"\r\n"
    RETURN   
    END CLASS

    Stefan

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

    • Page:
    • 1
    • 2