Menu

#1 Problem running on MAC: Comparer Exception

v1.0_(example)
open
nobody
None
5
2015-09-22
2013-01-08
No

When trying to run on MAC with latest Mono installed the program compiles fine but it throws following exception on startup:

System.ArgumentException: Comparer threw an exception.
at System.Collections.ArrayList.BinarySearch (System.Object value) [0x0001a] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System.Collections/ArrayList.cs:3092
at Prolog.Engine+BaseParser`1+BaseTrie[Prolog.Engine+OpDescrTriplet].AddToIndices (Prolog.TerminalDescr td) [0x00000] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/PG/BaseParser.cs:1018
at Prolog.Engine+BaseParser`1+BaseTrie[Prolog.Engine+OpDescrTriplet].Add (System.String key, Int32 iVal, Prolog.OpDescrTriplet payload, Int32 type) [0x0019b] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/PG/BaseParser.cs:1003
at Prolog.Engine+BaseParser`1+BaseTrie[Prolog.Engine+OpDescrTriplet].Add (Int32 iVal, Int32 type, System.String name, System.String[] images) [0x00020] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/PG/BaseParser.cs:940
at Prolog.Engine+BaseParser`1+BaseTrie[Prolog.Engine+OpDescrTriplet].Add (Int32 iVal, System.String name, System.String[] images) [0x00000] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/PG/BaseParser.cs:932
at Prolog.Engine+PrologParser.FillTerminalTable (Prolog.BaseTrie terminalTable) [0x0002c] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/PG/PL.cs:117
at Prolog.Engine.Initialize () [0x000cc] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/Engine.cs:590
at Prolog.Engine.Reset () [0x00000] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/Engine.cs:560
at Prolog.Engine..ctor (Prolog.BasicIo io) [0x0002e] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/Engine.cs:536
at Prolog.MainForm..ctor () [0x0007f] in /Users/tomi/Downloads/C#Prolog 3.1/PLw/MainForm.cs:225
at (wrapper remoting-invoke-with-check) Prolog.MainForm:.ctor ()
at Prolog.Program.Main (System.String[] args) [0x00048] in /Users/tomi/Downloads/C#Prolog 3.1/PLw/Program.cs:35

Seems like there is a problem with binary search.

Related

Support Requests: #1

Discussion

  • Jason RT Bond

    Jason RT Bond - 2015-09-22

    I'm also encountering this problem in version 3.2. In my case, I compiled the .dll in MonoDevelop and I'm trying to use it within the Unity game engine via a C# script. It throws a nearly-identical error on trying to instantiate PrologEngine.

    MacOS 10.10.5
    Mono version: custom Unity engine implementation (Unity 5.1 — roughly Mono 2.x)

     
    • Jason RT Bond

      Jason RT Bond - 2015-09-22

      Tried this same thing on Windows as well. Same error.

      Could this be related to the version of Mono?

       
    • John Pool

      John Pool - 2015-09-23

      Dear Jason,

      Unfortunately I do not have a Mac, nor was I in a position to test C#Prolog with the Unity engine. I vaguely remember something similar from a number of years ago. In that case, the solution was to add a second argument with a value ‘null’ to the BinarySearch call (search for “null req'd for MONO?” in the source). I would be happy to hear if that helps in this case.

      Kind regards,

      John Pool

      Van: Jason RT Bond [mailto:jrtb@users.sf.net]
      Verzonden: Tuesday, September 22, 2015 21:11
      Aan: [cs-prolog:support-requests]
      Onderwerp: [cs-prolog:support-requests] #1 Problem running on MAC: Comparer Exception

      I'm also encountering this problem in version 3.2. In my case, I compiled the .dll in MonoDevelop and I'm trying to use it within the Unity game engine via a C# script. It throws a nearly-identical error on trying to instantiate PrologEngine.

      MacOS 10.10.5
      Mono version: custom Unity engine implementation (Unity 5.1 — roughly Mono 2.x)


      [support-requests:#1] http://sourceforge.net/p/cs-prolog/support-requests/1/ Problem running on MAC: Comparer Exception

      Status: open
      Group: v1.0_(example)
      Created: Tue Jan 08, 2013 11:08 AM UTC by Tomas Trescak
      Last Updated: Thu Jan 10, 2013 07:45 AM UTC
      Owner: nobody

      When trying to run on MAC with latest Mono installed the program compiles fine but it throws following exception on startup:

      System.ArgumentException: Comparer threw an exception.
      at System.Collections.ArrayList.BinarySearch (System.Object value) [0x0001a] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System.Collections/ArrayList.cs:3092
      at Prolog.Engine+BaseParser1+BaseTrie[Prolog.Engine+OpDescrTriplet].AddToIndices (Prolog.TerminalDescr td) [0x00000] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/PG/BaseParser.cs:1018 at Prolog.Engine+BaseParser1+BaseTrie[Prolog.Engine+OpDescrTriplet].Add (System.String key, Int32 iVal, Prolog.OpDescrTriplet payload, Int32 type) [0x0019b] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/PG/BaseParser.cs:1003
      at Prolog.Engine+BaseParser1+BaseTrie[Prolog.Engine+OpDescrTriplet].Add (Int32 iVal, Int32 type, System.String name, System.String[] images) [0x00020] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/PG/BaseParser.cs:940 at Prolog.Engine+BaseParser1+BaseTrie[Prolog.Engine+OpDescrTriplet].Add (Int32 iVal, System.String name, System.String[] images) [0x00000] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/PG/BaseParser.cs:932
      at Prolog.Engine+PrologParser.FillTerminalTable (Prolog.BaseTrie terminalTable) [0x0002c] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/PG/PL.cs:117
      at Prolog.Engine.Initialize () [0x000cc] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/Engine.cs:590
      at Prolog.Engine.Reset () [0x00000] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/Engine.cs:560
      at Prolog.Engine..ctor (Prolog.BasicIo io) [0x0002e] in /Users/tomi/Downloads/C#Prolog 3.1/CSProlog/Engine.cs:536
      at Prolog.MainForm..ctor () [0x0007f] in /Users/tomi/Downloads/C#Prolog 3.1/PLw/MainForm.cs:225
      at (wrapper remoting-invoke-with-check) Prolog.MainForm:.ctor ()
      at Prolog.Program.Main (System.String[] args) [0x00048] in /Users/tomi/Downloads/C#Prolog 3.1/PLw/Program.cs:35

      Seems like there is a problem with binary search.


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/cs-prolog/support-requests/1/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/


      Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.
      https://www.avast.com/antivirus

       

      Related

      Support Requests: #1

      • Jason RT Bond

        Jason RT Bond - 2015-09-23

        Hi John,

        First, thank you very much for the quick reply. This project must be something you don't have tonnes of time for these days, so it's great you can still offer some support.

        The great news is that adding the null parameter does indeed fix the issue! For the record, I tried compiling the DLL and using it on Windows as well with the same issue, so I suspect it's a version of Mono at fault (in my case, the Mono branch used by Unity) rather than the platform. There are five or so places where the change was required (basically every call to BinarySort within BaseParser).

        In any case, I have it running now with your fix and have been able to make some queries to verify the engine is running in my project. I will have a couple other questions unrelated to the bug above which I'll post in the discussion section.

        Thanks again!

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.