1
votes

I want to use C# interface to SWI-Prolog. so I add the SwiPlCs.dll to project references and set SWI_HOME_DIR environment variable but when i test my application with this sample in here,I get this error:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

And the output from debug show:

The thread 0x1bec has exited with code 259 (0x103).

'swicall.vshost.exe' (CLR v4.0.30319: swicall.vshost.exe): Loaded 'G:\testingpro\MYAPP\swicall\bin\Debug\swicall.exe'. Symbols loaded.

'swicall.vshost.exe' (CLR v4.0.30319: swicall.vshost.exe): Loaded 'G:\testingpro\MyAPP\swicall\bin\Debug\SwiPlCs.dll'. Cannot find or open the PDB file.

A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

'swicall.vshost.exe' (CLR v4.0.30319: swicall.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

IF I copy swi-prolog dll files to my APP directly, the sample code works,but my codes faces with the 'Cannot find or open the PDB file 'message.

How to can I fix this error?

other information: OS:win8-64bit vs:2013-32bit SwiPlCs_1.1.60605.0 Swi-prolog ver7.3.8 Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"C:\Program Files (x86)\swipl")

1
You should set Copy Local on swi-prolog assembly reference, it will force VS to copy referenced assembly to bin\Debug directory. Cannot find PDB error - means that debugger cannot find .pdb file associated with SWI-prolog DLL (usually named like dll but with .pdb extension). PDB files are used be debuggers to locate and show source files e.g. on unhandled exception, in case when you are using external library you may ignore this error.csharpfolk
@ csharpfolk : You should set Copy Local on swi-prolog assembly reference,... I added SwiPlCs.dll to my refrences but i get An unhandled exception error....K.Ros
OK, I was able to reproduce your problem, try to add C:\Program Files (x86)\swipl\bin to system %PATH%, restart your computer (this is important), then it should work. Wrapper library was trying to load libswipl.dll using WIN32 LoadLibrary but cannot find it, hence strange error message.csharpfolk
I set system %PATH% but without any running error, the application is exited,and debug output is: 'WindowsFormsApplication1.vshost.exe' (CLR v4.0.30319: WindowsFormsApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'. Cannot find or open the PDB file. 'WindowsFormsApplication1.vshost.exe' (CLR v4.0.30319: WindowsFormsApplication1.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Deployment\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Deployment.dll'. Cannot find or open the PDB file.K.Ros
OK, I see - can you create Console application instead, then run it without debugging and check if it written anything to standard output (console)?csharpfolk

1 Answers

1
votes

I also faced the same problem. I installed the windows symbols from Microsoft site and error resolve. now sample code works fine.