Announcement

Collapse
No announcement yet.

HS-634 - mono-vbnc deprecated

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Scratch this, this is for building source with Visual Studio, not scripting, will keep looking.

    Originally posted by rjh View Post
    I did find this with some Googling, so I will experiment with this tag and see if this works:

    For some reason, Mono uses vbnc by default although there is a Roslyn-based VB compiler built-in to Mono, vbc. Interestingly, vbnc is even not being installed with mono-devel package and it still being used by default.

    If you installed vbnc and started to get this message:
    "error MSB6006: "vbnc.exe" exited with code 1"
    you need to instruct Mono to use vbc instead and your code will build. The most reliable way to do it is to set it per project, by adding the following XML to your vbproj file:
    <PropertyGroup> <VbcToolExe>vbc</VbcToolExe> </PropertyGroup>
    The code should be placed inside the root <Project> tag.
    πŸ’‍♂️ Support & Customer Service πŸ™‹‍♂️ Sales Questions πŸ›’ Shop HomeSeer Products

    Comment


      #17
      Originally posted by zwolfpack View Post
      If you'd bothered to read that you'd have discovered it's woefully out of date
      Am sorry for that error ( am not good in that field) but everything leads back to that document. And here is another (related) but also links you back : https://www.ossblog.org/mono-basic-visual-basic-compiler-runtime/ If doesn't mean anything just let me off with a slap on the wrist


      Eman.
      TinkerLand : Life's Choices,"No One Size Fits All"

      Comment


        #18
        Originally posted by rjh View Post
        I just use the scripting API I do not call VBNC directly so MONO is handling this.


        Maybe sending a PR to the MONO github , for them to call vbc ( instad of vbnc )when you call the vb compiler would help.

        Comment


          #19
          Originally posted by MattL0 View Post
          seems like copy pasting the content of /usr/bin/vbc :

          Code:
          exec /usr/bin/mono --gc-params=nursery-size=64m $MONO_OPTIONS /usr/lib/mono/4.5/vbc.exe "$@"
          into /usr/bin/vbnc resolve the aspx issue....

          So just calling vbc (HST) instead of vbnc would resolve the compiling issue saw on hs3.

          The aspx page are loading quite faster now ! WOW

          bsobel



          I can even open /BLLock_activity.aspx now :O
          With this’’ fix’’ (or when hst will find a way to call vbc directly).... does that mean that running .vb script on linux will be as fault tolerant as on windows (since vbc use the same vb engine as on windows).... so some script on the board will also maybe work on linux now !!! ???

          Comment


            #20
            rjh jseer

            Bad news/good news - It seems the VBCodeProvider class is hardcoded to use vbnc compiler, with no opportunity to override via configuration.

            VBCodeProvider class is implemented at
            https://github.com/mono/mono/blob/ma...odeProvider.cs

            which invokes VBCodeGenerator class from
            https://github.com/mono/mono/blob/ma...deGenerator.cs

            which calls MonoToolsLocator from
            https://github.com/mono/mono/blob/ma...oolsLocator.cs

            VBCompiler is a readonly property set at line 76 to /usr/bin/vbnc, or if that file doesn't exist, line 78 sets it to /usr/lib/mono/4.5/vbnc.exe.

            ====

            This should be considered experimental only, but as Matt pointed out earlier, vbc can be used in place of vbnc by modifying the /usr/bin/vbnc script.

            An issue: under vbc, embedding an hs.xxx call within another hs.xxx call generates an exception and the script quits. Crazy thing, the embedded statement appears to work properly before the exception is thrown. See https://forums.homeseer.com/forum/de...23#post1365623 and following example.

            Test script
            Code:
            Sub Main(parm as object)
                Dim logName As String = hs.GetLastEvent
            
                hs.WriteLogEx(logName, "start", "#ff00ff")
            
                Dim dvRef = hs.GetDeviceRefByName("Moon Phase")
                hs.WriteLogEx("split", dvRef, "#ff00ff")
            
                hs.WriteLogEx("embedded", hs.GetDeviceRefByName("Moon Phase"), "#ff00ff")
            
                hs.WriteLogEx(logName, "finished", "#ff00ff")
            End Sub
            Run under vbnc, works as expected:
            Code:
            Feb-23 22:05:14           VBC Test 1     start
            Feb-23 22:05:14           split     386
            Feb-23 22:05:14           embedded     386
            Feb-23 22:05:14           VBC Test 1     finished
            Run under vbc
            Code:
            Feb-23 22:08:46           VBC Test 1     start
            Feb-23 22:08:46           split     386
            Feb-23 22:08:46           embedded     386
            Feb-23 22:08:46           Error 1     Running script /opt/HomeSeer/scripts/vbctest1.vb :Exception has been thrown by the target of an invocation.Method 'Scheduler.hsapplication.GetDeviceRefByName' not found.
            Note how the "embedded" line produces the expected output, but then an exception is thrown and the "finished" line doesn't appear.

            I've tried several other test cases; in each an "hs with an hs" throws an exception after the embedded statement does what it should do.

            Some good news though - I finally got sparkman's awesome 'Events with Scripts' working on HS3-Linux! Under vbnc, array handling bugs caused HS3 to crash when the script was run.

            Comment


              #21
              So calling an object inside another one can’t be done with vbc.

              ex: I want to set a value tu the value of another device .


              at that point. Should just homeseer communicate to mono via github ...to change their code that use the depreciated vbnc when hs call vbcodecompiler class?? Or is the embedded call won work in that case too?

              Comment


                #22
                A workaround to the embedded call issue is to split the embedded statement into two as I did in the example.

                As to what HomeSeer should do ... that's up to them. I've run with it about as far as I can; I'm no dotNet developer ... I installed Visual Studio less than a month ago

                Comment


                  #23
                  Workarounds are fine in open source but I’d definitely leave this to HS on the commercial side. Best they resolve these issues directly with Xamirin and release an update to reflect their findings.

                  Comment


                    #24
                    I did ask the MONO group about this but no response so far so I have doubts that they will do anything about it any time soon. Also, Microsoft just announced they are no longer adding any features to VB so I suspect efforts regarding any work on it will be ignored, or priority lowered (just my guess).

                    There is a post a in this forum on a workaround, will that work for you?
                    πŸ’‍♂️ Support & Customer Service πŸ™‹‍♂️ Sales Questions πŸ›’ Shop HomeSeer Products

                    Comment


                      #25
                      Originally posted by rjh View Post

                      There is a post a in this forum on a workaround, will that work for you?
                      no! because of this ! this is an easy fix. Please reasd the thread entirely
                      https://forums.homeseer.com/forum/de...ersion-3-0-0-1

                      Comment


                        #26
                        Hoping this is implemented in HS4. It works nicely in HS3 these days.

                        - Pete

                        Auto mator
                        Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                        Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                        HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

                        HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                        HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                        X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                        Comment


                          #27
                          logged
                          πŸ’β€β™‚οΈ Support & Customer Service πŸ™‹β€β™‚οΈ Sales Questions πŸ›’ Shop HomeSeer Products​

                          Comment


                            #28
                            xbuild-use-roslyn-vbc.patch

                            Caution! This is not my field but a question Can this approach be used to fix the mono issue by changing the version in this file :https://build.opensuse.org/package/v...patch?expand=1 by replacing it with the current version of mono which is mentioned here? (In other words "Hack it" ?) Or is it the same as it's expressed here #14 : https://forums.homeseer.com/forum/de...71#post1363571



                            Eman.
                            TinkerLand : Life's Choices,"No One Size Fits All"

                            Comment


                              #29
                              Originally posted by Eman View Post
                              xbuild-use-roslyn-vbc.patch

                              Caution! This is not my field but a question Can this approach be used to fix the mono issue by changing the version in this file :https://build.opensuse.org/package/v...patch?expand=1 by replacing it with the current version of mono which is mentioned here? (In other words "Hack it" ?) Or is it the same as it's expressed here #14 : https://forums.homeseer.com/forum/de...71#post1363571



                              Eman.
                              Rich has fixed the mono issue in a test beta: https://forums.homeseer.com/forum/de...05#post1370405
                              Jon

                              Comment


                                #30
                                Originally posted by jon00 View Post

                                Rich has fixed the mono issue in a test beta: https://forums.homeseer.com/forum/de...05#post1370405
                                Nice one!


                                Eman.
                                TinkerLand : Life's Choices,"No One Size Fits All"

                                Comment

                                Working...
                                X