Page 1 of 1

GPCP Unhandled Exception

Posted: Tue Feb 22, 2022 11:02 pm
by Helpdesk
I have installed Component Pascal and CPIde on my Windows 10 laptop. When I try to compile the simple "Hello World" example within CPIde I see:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at GPBinFiles.GPBinFiles.findOnPath(Char[] pathName, Char[]
fileName) in
c:\Users\xxxx\CurrentProjects\CVS-GPCP-NET\sources\libs\csharp\GPBinFiles.cs:line
95
at NewSymFileRW.SymFileReader.Parse(BlkId scope) in NewSymFileRW.cp:line 1162 at NewSymFileRW.ImpResScope.ReadThisImport(BlkId imp) in NewSymFileRW.cp:line 2147 at NewSymFileRW.NewSymFileRW.WalkImports(ScpSeq& imps, BlkId modI) in NewSymFileRW.cp:line 2182 at CPascalP.CPascalP.ImportList(BlkId modScope) in CPascalP.cp:line 467 at CPascalP.CPascalP.CPmodule() in CPascalP.cp:line 235 at CPascalP.CPascalP.Module() in CPascalP.cp:line 3437 at CPascalP.CPascalP.Parse() in CPascalP.cp:line 3457 at CPascal.CPascal.Compile(Char[] nam, Int32& retVal) in CPascal.cp:line 138 at gpcp.gpcp..CPmain(String[] A_0) in gpcp.cp:line 42
Any idea where I might have made a mistake?

Re: GPCP Unhandled Exception

Posted: Tue Feb 22, 2022 11:09 pm
by cfbsoftware
The clues in the exception traceback report are the procedure calls GPBinFiles.findOnPath and NewSymFileRW.SymFileReader.Parse.

This indicates to me that it is in the process of looking for symbol files on your path. As this is a new installation I suspect that the CPSYM environment variable required by GPCP has not been setup properly, or is not visible to your current Windows user when you are running the compiler. Refer to Section 2 in the GPCP Getting Started documentation.

You can check the value of CPSYM by starting a command prompt (e.g. by running cmd, or Start > All Programs > Accessories > Command Prompt)

In the command window type:

Code: Select all

echo %CPSYM%
On my system the command and resulting response looks like:

Code: Select all

C:\Users\CFB Software>  echo %CPSYM%
.;C:\GPCPx\symfiles\NetSystem\;C:\GPCPx\symfiles\;

Re: GPCP Unhandled Exception

Posted: Wed Oct 04, 2023 7:47 pm
by JonRobertson
I just installed CP and CPIde 8.1 and I am having the same issue, as well as a couple others when compiling the example projects.

I verified that CPSYM is set and that the dirs/folders in CPSYM are correct.

Code: Select all

echo %CPSYM%
.;C:\Users\jonro\gpcp-NET\symfiles;C:\Users\jonro\gpcp-NET\symfiles\NetSystem
I can compile Hello.cp using gpcp at the command line without errors:

Code: Select all

C:\Prj\CP\Hello>gpcp Hello.cp
#gpcp: Created Hello.exe
#gpcp: <Hello> No errors
But attempting to compile with CPIde results in this exception:

Code: Select all

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at GPBinFiles.GPBinFiles.findOnPath(Char[] pathName, Char[] fileName) in c:\Users\john\CurrentProjects\CVS-GPCP-NET\sources\libs\csharp\GPBinFiles.cs:line 95
   at NewSymFileRW.SymFileReader.Parse(BlkId scope) in NewSymFileRW.cp:line 1162
   at NewSymFileRW.ImpResScope.ReadThisImport(BlkId imp) in NewSymFileRW.cp:line 2147
   at NewSymFileRW.NewSymFileRW.WalkImports(ScpSeq& imps, BlkId modI) in NewSymFileRW.cp:line 2182
   at CPascalP.CPascalP.ImportList(BlkId modScope) in CPascalP.cp:line 467
   at CPascalP.CPascalP.CPmodule() in CPascalP.cp:line 235
   at CPascalP.CPascalP.Module() in CPascalP.cp:line 3437
   at CPascalP.CPascalP.Parse() in CPascalP.cp:line 3457
   at CPascal.CPascal.Compile(Char[] nam, Int32& retVal) in CPascal.cp:line 138
   at gpcp.gpcp..CPmain(String[] A_0) in gpcp.cp:line 42

Re: GPCP Unhandled Exception

Posted: Fri Oct 06, 2023 6:28 am
by cfbsoftware
Maybe because you are using two different user names: john and jonro?