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

    #16
    Not sure why the full path is not working. Can you remove the full path from the INI file then update to this build of HS3 and see if it works ok. Just put the part of the path where the file is like:

    bin\scripting\Newtonsoft.Json.dll

    This update to HS3 will automatically create the full path and add it to compiler as needed. It seems to work ok here.

    http://homeseer.com/updates3/SetupHS3_3_0_0_346.msi

    Originally posted by bartbakels View Post
    any other suggestions?

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

    Comment


      #17
      rjh,

      I just noticed that when I put the Newtonsoft.Json.dll inside the Bin directory (and not a just created subdirectory in it) and change the reference in the settings.ini to the full path without quotes IT WORKS.

      It almost seems to be a problem with directory security/ownership..

      FYI: I am running on windows 10, and found this solution in the following topic (thanks to jfla): https://forums.homeseer.com/showthread.php?t=183704
      Last edited by psmaaswinkel; July 25, 2017, 02:10 PM. Reason: source added

      Comment


        #18
        Well, HS already has a search to the bin folder, so it might be using the path you entered. I assume you did try a sub folder of bin that you created?

        Originally posted by psmaaswinkel View Post
        rjh,

        I just noticed that when I put the Newtonsoft.Json.dll inside the Bin directory (and not a just created subdirectory in it) and change the reference in the settings.ini to the full path without quotes IT WORKS.

        It almost seems to be a problem with directory security/ownership..

        FYI: I am running on windows 10, and found this solution in the following topic (thanks to jfla): https://forums.homeseer.com/showthread.php?t=183704
        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

        Comment


          #19
          rjh,

          Indeed I tried a subfolder first, but even after setting the full path inside the settings.ini file the scripts where still failing...

          Comment


            #20
            Originally posted by rjh View Post
            Not sure why the full path is not working. Can you remove the full path from the INI file then update to this build of HS3 and see if it works ok. Just put the part of the path where the file is like:

            bin\scripting\Newtonsoft.Json.dll

            This update to HS3 will automatically create the full path and add it to compiler as needed. It seems to work ok here.

            https://homeseer.com/updates3/SetupHS3_3_0_0_346.msi
            i tried this version

            but again;

            Code:
            jul-25 21:26:36	 	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)
            with this scripting ref;

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


            I tried also psmaaswinkels solution, with 346, which doesnt work for me either;

            Newtonsoft.json;C:\Program Files (x86)\HomeSeer HS3\bin\scripting\Newtonsoft.Json.dll

            and also

            Newtonsoft.json;C:\Program Files (x86)\HomeSeer HS3\bin\Newtonsoft.Json.dll

            same errors,


            but another thought. Its not the problem that it cant find the dll, because when i use an invalid path in the scripting reference i get other errors for all my scripts (compiler issues). looking to the error at hand, HS3 uses the wrong version of the newtonsoft dll so another dll is loaded when not located in the hs3 root.


            Bart
            Last edited by bartbakels; July 25, 2017, 02:48 PM.
            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


              #21
              rich,

              any other things i can try?

              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


                #22
                Rich,

                I found the issue...

                I replaced the newtonsoft dll in bin\homeseer with the version i needed for my scripts, this resolved the issue. Scripting reference still ste to bin\scripting\newtonsoft.json.dll.

                this means that the dll in bin\homeseer is used, so that the issue, the refrences are not being respected, prob due to the same name?

                However i dont get any errors now in HS3, and json commands still work, i dont know the influence the replacement of the json file has on HS3 itself?


                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


                  #23
                  Did you try the latest beta build?

                  The bin/homeseer folder is ignored when running scripts. I tested this by putting the newtonsoft dll in the bin/homeseer folder but then in scriptreferences I referenced a different sub folder for that dll and it failed, until I put the newtonsoft dll in the new folder.

                  Originally posted by bartbakels View Post
                  Rich,

                  I found the issue...

                  I replaced the newtonsoft dll in bin\homeseer with the version i needed for my scripts, this resolved the issue. Scripting reference still ste to bin\scripting\newtonsoft.json.dll.

                  this means that the dll in bin\homeseer is used, so that the issue, the refrences are not being respected, prob due to the same name?

                  However i dont get any errors now in HS3, and json commands still work, i dont know the influence the replacement of the json file has on HS3 itself?


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

                  Comment


                    #24
                    The build that you posted is indeed my production version, so 346
                    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


                      #25
                      Build 404

                      It would appear I'm now hitting a variation of this while trying to get a script from wpiman to work.

                      I already have a Newtonsoft.Json.dll in .\HomeSeer HS3\bin\ that I didn't put it there myself. Something else did. When trying to run the script with the system as-is (newtonsoft.json.dll in .\bin\ and no ScriptingReferences entry) it errors saying the Json components were not imported.

                      I then created ScriptingReferences=Newtonsoft.Json;Newtonsoft.Json.dll

                      This wasn't enough, but also copying (not moving) Newtonsoft.Json.dll into .\HomeSeer HS3\ made the script work.


                      Unfortunately, this also broke the ecobee and JowiHue plugins. Here's an error from JowiHue that looks like it did not like the version of Newtonsoft.Json.dll it was now seeing.


                      Error: (UpdateBridgeCache):Is Bridge Philips hue reachable? 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)

                      There are seven instances of Newtonsoft.json.dll in my entire homeseer directory structure.

                      .\bin\ = v9.0.1.19813
                      .\bin\weatherXML\ = v9.0.1.19813
                      .\bin\homeseer\ = v8.0.3.19514
                      .\bin\Z-Wave = v8.0.3.19514
                      .\bin\Imperihome\ = v7.0.1.18622 (499KB) (Must be leftover files as this plugin is not installed.)
                      .\bin\Ecobee\ = v7.0.1.18622 (508KB)
                      .\bin\JowiHue\ = v7.0.1.18622 (499KB)

                      Of the list above, both Ecobee and JowiHue share the same oldest common version of 7.0.1.18622. The one I copied into .\HomeSeer HS3\ was the v9.0.1.19813 from .\bin\ listed above.

                      Removing ScriptingReferences from settings.ini wasn't enough to fix ecobee and JowiHue. It was the act of removing NewtonSoft.json.dll from .\HomeSeer HS3\ that repaired those plug-ins, yet made wpiman's script fail again.

                      I'll try making a .\bin\newtonsoft\ directory and placing a copy in there, then pointing to it with ScriptingReferences and see what I get.

                      Comment


                        #26
                        Build 404

                        Created a .\bin\NewtonSoftJson\ directory, copied the .DLL there.

                        Set... ScriptingReferences=Newtonsoft.Json;C:\"Program Files (x86)\HomeSeer HS3"\Bin\Newtonsoft.Json.dll

                        Resulted in...
                        Jan-24 11:42:37 AM Error Compiling script Startup.vb: Illegal characters in path.

                        I changed it to the 8.3 path format...

                        ScriptingReferences=Newtonsoft.Json;C:\PROGRA~2\HOMESE~1\Bin \NewtonSoftJson\Newtonsoft.Json.dll

                        This got rid of the illegal characters error at HS3 startup, but the script still fails with the following so I'm not sure what it's using. Maybe I'll fire up procmon later and see what file it is touching on the drive.

                        Running script C:\Program Files (x86)\HomeSeer HS3\scripts\tankUtility.vb :Exception has been thrown by the target of an invocation.Could not load file or assembly 'Newtonsoft.Json, Version=9.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)

                        Comment


                          #27
                          I know this is several months old, but in case anyone else runs into this: you cannot use a scripting reference to a Newtonsoft.Json.dll file that doesn't match the one already loaded by HS3, even though it's not automatically exposed to scripts. If you're going to add a ScriptingReference, a) you don't need 8.3 or quotes - just type it out normally, and b) use the one in the bin\homeseer directory.

                          Comment


                            #28
                            And as I think I've mentioned before, the solution for all of us would be to expose that library directly so we can reference it from the hs object in both scripts and plugins, negating the need for so many different copies and potential for issues!

                            Comment


                              #29
                              Hopefully a simple question on this requirement:

                              I have the exe.config file generated by VS and have the string in it set as stated below for my plug-in. I can include it in my install zip file but where is it supposed to be installed in the directory structure? In my private bin folder next to the JSON DLL? Somewhere else? I'm going to try in my private bin folder but thought I'd ask while am working on it.

                              Note, I am using this with my plug-in, not as part of any scripts so the ScriptingReferences stuff discussed in most of this thread doesn't apply I am pretty sure.

                              thx

                              XM

                              Originally posted by rjh View Post
                              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.

                              Comment


                                #30
                                The exe.config file goes in the HS3 root directory along with your plugin exe file. The private bin folder is for any other DLLs you reference to avoid conflicts with other people using the same DLL but that might not always be the exact same version.

                                Comment

                                Working...
                                X