Announcement

Collapse
No announcement yet.

Important if you are using the Newtonsoft DLL in your plugin!

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Important if you are using the Newtonsoft DLL in your plugin!

    The following changes need to be made in order for your plugin to function properly with the HS3 version 3.0.0.333 or later.

    If you reference the Newtonsoft JSON DLL in your plugin, make sure you install that dll in your own folder. Lets assume your plugin is named "AcmePlugin", your install.txt should install the Newtonsoft dll to:

    bin\AcmePlugin

    You should then include a exe.config file with the bin path set like so:
    Code:
    <probing privatePath="bin/AcmePlugin;bin" />
    Note, many plugins are including the exe.config file and the bin path, but they are including "bin" before their own path, this is incorrect. Make sure "bin" is added after your private path.
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    #2
    My BlueIris plugin fell victim to this issue for a number of users. I've added code to check for the DLL in the root and throw an error if it's there alerting users.

    However, I have one user that uses it in a script and is saying it needs to be in the HS3 root.

    https://forums.homeseer.com/showthread.php?t=190098

    I thought this could be solved using the ScriptingReferences parameter in the settings.ini file, but it would seem that's not working.

    Any thoughts?
    Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

    Comment


      #3
      Did they put the newtonsoft dll in their own bin folder then put the path in the scriptingreferences like:

      bin/mypath/NewtonSoft.dll

      That looks like it should work. They cannot put it in the bin folder, that will break HS and other plugins.

      Originally posted by beerygaz View Post
      My BlueIris plugin fell victim to this issue for a number of users. I've added code to check for the DLL in the root and throw an error if it's there alerting users.

      However, I have one user that uses it in a script and is saying it needs to be in the HS3 root.

      https://forums.homeseer.com/showthread.php?t=190098

      I thought this could be solved using the ScriptingReferences parameter in the settings.ini file, but it would seem that's not working.

      Any thoughts?
      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

      Comment


        #4
        Originally posted by rjh View Post
        Did they put the newtonsoft dll in their own bin folder then put the path in the scriptingreferences like:

        bin/mypath/NewtonSoft.dll

        That looks like it should work. They cannot put it in the bin folder, that will break HS and other plugins.
        Yes that is exactly what i troed, but that didnt work either. So made a folder in bin/scripting/newtonsoftblabla.dll

        And added this line in the scriptingrefrence, and restarted but did broke several scripts.

        Bart
        Regards Bart
        ------------------------------------------
        Win7 64Bit on Intel NUCI7 with SSD
        HSPRO 3.
        Devices; 1370 Events; 691

        Jon00 Scripts, JowHue, HSTouch, Plugwise, Z-wave, Ultranetatmo, Ultracam, PHlocation, BLUSBUIRT, MeiHarmony, Buienradar, MEiUnifi Pushover 3P, Random, Nest HSPhone and Blueiris

        Visonic Powermax Alarm System (HS3) Interface: http://www.domoticaforum.eu/viewtopic.php?f=68&t=11129

        Comment


          #5
          Rich,

          Any solution for this, i cant remove the newtonsoft.json.dll to another location because it breaks my scripts.
          Regards Bart
          ------------------------------------------
          Win7 64Bit on Intel NUCI7 with SSD
          HSPRO 3.
          Devices; 1370 Events; 691

          Jon00 Scripts, JowHue, HSTouch, Plugwise, Z-wave, Ultranetatmo, Ultracam, PHlocation, BLUSBUIRT, MeiHarmony, Buienradar, MEiUnifi Pushover 3P, Random, Nest HSPhone and Blueiris

          Visonic Powermax Alarm System (HS3) Interface: http://www.domoticaforum.eu/viewtopic.php?f=68&t=11129

          Comment


            #6
            Do you have a sample script I can test with? Maybe the scripting references is not working properly.

            Originally posted by bartbakels View Post
            Rich,

            Any solution for this, i cant remove the newtonsoft.json.dll to another location because it breaks my scripts.
            💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

            Comment


              #7
              Originally posted by rjh View Post
              Do you have a sample script I can test with? Maybe the scripting references is not working properly.
              rich,

              i tried moving the newtonsoft.json.dll to bin and into bin\scripting and changing the scripting reference to;

              Newtonsoft.Json;bin\Newtonsoft.Json.dll
              Newtonsoft.Json;bin\scripting\Newtonsoft.Json.dll

              both created these errors;

              Code:
              jul-24 9:29:28	 	Error 1	Running script C:\Program Files (x86)\HomeSeer HS3\scripts\Domoticz Interface.vb :Exception has been thrown by the target of an invocation.Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

              I will send you 1 of the the scripts by mail, because they include credentials which u need to test.

              Bart
              Regards Bart
              ------------------------------------------
              Win7 64Bit on Intel NUCI7 with SSD
              HSPRO 3.
              Devices; 1370 Events; 691

              Jon00 Scripts, JowHue, HSTouch, Plugwise, Z-wave, Ultranetatmo, Ultracam, PHlocation, BLUSBUIRT, MeiHarmony, Buienradar, MEiUnifi Pushover 3P, Random, Nest HSPhone and Blueiris

              Visonic Powermax Alarm System (HS3) Interface: http://www.domoticaforum.eu/viewtopic.php?f=68&t=11129

              Comment


                #8
                I tried it here with HS build 343 and it appears to work ok. My scripting references was set to:

                ScriptingReferences=Newtonsoft.json;bin\homeseer\Newtonsoft. Json.dll

                I don't know why it was not working for you, your references look ok.

                I assume this is on Windows?

                Originally posted by bartbakels View Post
                rich,

                i tried moving the newtonsoft.json.dll to bin and into bin\scripting and changing the scripting reference to;

                Newtonsoft.Json;bin\Newtonsoft.Json.dll
                Newtonsoft.Json;bin\scripting\Newtonsoft.Json.dll

                both created these errors;

                Code:
                jul-24 9:29:28	 	Error 1	Running script C:\Program Files (x86)\HomeSeer HS3\scripts\Domoticz Interface.vb :Exception has been thrown by the target of an invocation.Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

                I will send you 1 of the the scripts by mail, because they include credentials which u need to test.

                Bart
                💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                Comment


                  #9
                  nope,


                  still get the same error;

                  Code:
                  jul-24 18:12:34	 	Error 1	Running script C:\Program Files (x86)\HomeSeer HS3\scripts\Domoticz Interface.vb :Exception has been thrown by the target of an invocation.Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

                  scripting reference entry is this in full;


                  ScriptingReferences=System.XML;System.XML.dll,System.Data;Sy stem.Data.Dll,System.Web;System.Web.dll,System.Web.DataVisua lization;System.Web.DataVisualization.dll,System.Drawing;Sys tem.Drawing.dll,Newtonsoft.json;bin\Scripting\Newtonsoft.Jso n.dll,DDay.iCal;DDay.iCal.dll

                  i am also on 343, and cant find any other newtonsoft files near the hs3 installation except in the bin subfolders...., maybe you are using the corrrect dll version by coincedence?

                  Bart
                  Regards Bart
                  ------------------------------------------
                  Win7 64Bit on Intel NUCI7 with SSD
                  HSPRO 3.
                  Devices; 1370 Events; 691

                  Jon00 Scripts, JowHue, HSTouch, Plugwise, Z-wave, Ultranetatmo, Ultracam, PHlocation, BLUSBUIRT, MeiHarmony, Buienradar, MEiUnifi Pushover 3P, Random, Nest HSPhone and Blueiris

                  Visonic Powermax Alarm System (HS3) Interface: http://www.domoticaforum.eu/viewtopic.php?f=68&t=11129

                  Comment


                    #10
                    The problem is that the scripting system requires the referenced DLL to include the full path if its not in the HS folder. Odd, since if I just add a DLL it knows to search the HS folder.

                    So I automatically add the full path to any scripting reference to add.

                    For you to test, add the full path to the ScriptingReferences INI entry.

                    Originally posted by bartbakels View Post
                    nope,


                    still get the same error;

                    Code:
                    jul-24 18:12:34	 	Error 1	Running script C:\Program Files (x86)\HomeSeer HS3\scripts\Domoticz Interface.vb :Exception has been thrown by the target of an invocation.Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

                    scripting reference entry is this in full;


                    ScriptingReferences=System.XML;System.XML.dll,System.Data;Sy stem.Data.Dll,System.Web;System.Web.dll,System.Web.DataVisua lization;System.Web.DataVisualization.dll,System.Drawing;Sys tem.Drawing.dll,Newtonsoft.json;bin\Scripting\Newtonsoft.Jso n.dll,DDay.iCal;DDay.iCal.dll

                    i am also on 343, and cant find any other newtonsoft files near the hs3 installation except in the bin subfolders...., maybe you are using the corrrect dll version by coincedence?

                    Bart
                    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                    Comment


                      #11
                      Rich,

                      What should be the correct syntax in that case to handle spaces

                      C:\program files\hs3\bin\scripting

                      Should i use "" or something else?

                      Bart
                      Regards Bart
                      ------------------------------------------
                      Win7 64Bit on Intel NUCI7 with SSD
                      HSPRO 3.
                      Devices; 1370 Events; 691

                      Jon00 Scripts, JowHue, HSTouch, Plugwise, Z-wave, Ultranetatmo, Ultracam, PHlocation, BLUSBUIRT, MeiHarmony, Buienradar, MEiUnifi Pushover 3P, Random, Nest HSPhone and Blueiris

                      Visonic Powermax Alarm System (HS3) Interface: http://www.domoticaforum.eu/viewtopic.php?f=68&t=11129

                      Comment


                        #12
                        Looks like its double quotes:

                        https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx


                        Originally posted by bartbakels View Post
                        Rich,

                        What should be the correct syntax in that case to handle spaces

                        C:\program files\hs3\bin\scripting

                        Should i use "" or something else?

                        Bart
                        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                        Comment


                          #13
                          Originally posted by rjh View Post

                          ok i tried this now;


                          ScriptingReferences=Newtonsoft.json;"C:\Program Files (x86)\HomeSeer HS3\Bin\Scripting\Newtonsoft.Json.dll",System.XML;System.XML .dll,System.Data;System.Data.Dll,System.Web;System.Web.dll,S ystem.Web.DataVisualization;System.Web.DataVisualization.dll ,System.Drawing;System.Drawing.dll,DDay.iCal;DDay.iCal.dll

                          but then these in log;

                          Code:
                          jul-24 23:12:33	 	Error	Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\MeterstandenVerbruik.vb: Illegal characters in path.
                          jul-24 23:12:33	 	Error	Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\LogNetworkOutage.vb: Illegal characters in path.
                          jul-24 23:12:33	 	Error	Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\Extern IP Monitor.vb: Illegal characters in path.
                          tried also to put it in de root and use this

                          c:\newtonsoft.json.dll

                          and this is also NOT working.

                          same error as in post above
                          Regards Bart
                          ------------------------------------------
                          Win7 64Bit on Intel NUCI7 with SSD
                          HSPRO 3.
                          Devices; 1370 Events; 691

                          Jon00 Scripts, JowHue, HSTouch, Plugwise, Z-wave, Ultranetatmo, Ultracam, PHlocation, BLUSBUIRT, MeiHarmony, Buienradar, MEiUnifi Pushover 3P, Random, Nest HSPhone and Blueiris

                          Visonic Powermax Alarm System (HS3) Interface: http://www.domoticaforum.eu/viewtopic.php?f=68&t=11129

                          Comment


                            #14
                            any other suggestions?

                            bart
                            Regards Bart
                            ------------------------------------------
                            Win7 64Bit on Intel NUCI7 with SSD
                            HSPRO 3.
                            Devices; 1370 Events; 691

                            Jon00 Scripts, JowHue, HSTouch, Plugwise, Z-wave, Ultranetatmo, Ultracam, PHlocation, BLUSBUIRT, MeiHarmony, Buienradar, MEiUnifi Pushover 3P, Random, Nest HSPhone and Blueiris

                            Visonic Powermax Alarm System (HS3) Interface: http://www.domoticaforum.eu/viewtopic.php?f=68&t=11129

                            Comment


                              #15
                              I can confirm this problem after moving the DLL file to the new location. All custom scripts using it fail on run....

                              Comment

                              Working...
                              X