Announcement

Collapse
No announcement yet.

c# script does not compile after restart due to linq references

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

  • c# script does not compile after restart due to linq references

    [update #1] Turns out none of my c# scripts are working now due to errors similar to this one, mostly failed linq calls. The only thing I did was restart the application (not the server) and boom, all of a sudden its like certain libraries just vanished...

    I wrote a c# script yesterday and it worked great all day up until this morning. This morning I restarted my Homeseer application and now the script does not compile. The error message makes it sound like I'm now missing a reference to system.linq. Any idea how could a restart cause this, and how can I fix this?

    error:
    Compiling script C:\Program Files\HomeSeer HS3\scripts\MontlyShittyRunDownEmail.cs: {interactive}(37,47): error CS1061: Type `System.Collections.Generic.List' does not contain a definition for `Min' and no extension method `Min' of type `System.Collections.Generic.List' could be found (are you missing a using directive or an assembly reference?) {interactive}(39,45): error CS1061: Type `System.Collections.Generic.List' does not contain a definition for `Max' and no extension method `Max' of type `System.Collections.Generic.List' could be found (are you missing a using directive or an assembly reference?) {interactive}(47,42): error CS0122: `System.Collections.Generic.List.Count' is inaccessible due to its protection level {interactive}(47,42): error CS1955: The member `System.Collections.Generic.List.Count' cannot be used as method or delegate {interactive}(49,43): error CS0122: `System.Collections.Generic.List.Count' is inaccessible due to its protection level {interactive}(49,43): error CS1955: The member `System.Collections.Generic.List.Count' cannot be used as method or delegate {interactive}(51,44): error CS0122: `System.Collections.Generic.List.Count' is inaccessible due to its protection level {interactive}(51,44): error CS1955: The member `System.Collections.Generic.List.Count' cannot be used as method or delegate {interactive}(119,56): error CS1061: Type `System.Collections.Generic.List' does not contain a definition for `Where' and no extension method `Where' of type `System.Collections.Generic.List' could be found (are you missing a using directive or an assembly reference?) {interactive}(137,90): error CS0122: `System.Collections.Generic.List.Count' is inaccessible due to its protection level {interactive}(137,90): error CS1955: The member `System.Collections.Generic.List.Count' cannot be used as method or delegate {interactive}(7,17): warning CS0414: The private field `Script.hs' is assigned but its value is never used


    homeseer information:
    Current Date/Time: 2/14/2018 9:43:27 AM Central Standard Time
    HomeSeer Version: HS3 Pro Edition 3.0.0.368 (Windows)
    HomeSeer: Is Registered
    Operating System: Microsoft Windows Embedded Standard - Work Station
    OS Version: 6.1.7601 Service Pack: 1.0
    System Uptime: 0 Days 2 Hours 35 Minutes 52 Seconds
    User Name and Access Level: admin (Admin)
    LAN IP Address: 192.168.1.224 (hometroller)
    Client IP Address: (hometroller)

    Network Adapter: HomeSeer Adapter -> Loopback Address (localhost) IP: 127.0.0.1
    Web Server Port: 80
    Number of Devices: 145
    Number of Events: 68
    Event Last Ran: Shitty Town : Stop Shitty Fan, Ran at 2/14/2018 9:08:24 AM
    Number of unique event scripts used: 3

    Plug-Ins Enabled: Z-Wave:,JowiHue:,PHLocation:,UltraWeatherBug3:,BLOccupied:,Har mony Hub:,EasyTrigger:,Honeywell WiFi Thermostat:
    Processor Type and Speed: x64 Family 6 Model 61 Stepping 4 at 472.07 MHz
    Modules/Threads: 123 Modules, 111 Threads
    Available Threads: 199
    System Processes/Load: 68 Processes, 6% Load
    Free / Total Physical Memory: 1.70 GBytes / 2.53 GBytes (67% free)
    Free / Total Virtual Memory: 4.21 GBytes / 5.06 GBytes (83% free)
    HomeSeer Memory Used: 114 Mbytes
    Plug-In Memory Used: 7 EXE Plug-Ins using 186 Mbytes
    Last edited by osro; February 14th, 2018, 01:51 PM.

  • #2
    [update #1] I rewrote the startup script in CS and added those using statements from before, removed them from my original script and everything works fine. In the future I'll just continue add more using statements to the startup.cs to avoid weird situations like this in the future.

    I think I figured it out. I added "using..." at the top of one my scripts and it seems to have fixed all my scripts. If I had to GUESS what happened, I'd say: It had been a long time since my last restart so I may have had a now removed plugin that used those assemblies. Everything was fine until I did the restart and that plugin (now removed) was gone so those assemblies did not get loaded... Maybe? meh...

    A proper solution would be to make my startup script in cs and add those using statements to the top of that file and have them managed in one central location.

    using System.Core;
    using System.Linq;
    public Object Main(Object[] parm)
    {
    return 0;
    }
    Last edited by osro; February 14th, 2018, 07:50 PM.

    Comment


    • #3
      How is the support for C# in Homeseer? I have no experience with .Net programming but know Java and Groovy. C# is miles closer to what I'm familiar with than VB. VB actually gives me the willies remembering trying it in the 90s.

      Is going all out on C# a dead end or is it possible to make it work?

      Stian

      Comment


      • #4
        VB .Net has come a long way from what you are familiar with (I assume VB4?). I program in both languages, and C# and VB.net are very similiar in capabilities. Only the syntax varies between the two.

        I do not think you will go wrong using C# though.

        Comment


        • #5
          Originally posted by strips View Post
          How is the support for C# in Homeseer? I have no experience with .Net programming but know Java and Groovy. C# is miles closer to what I'm familiar with than VB. VB actually gives me the willies remembering trying it in the 90s.

          Is going all out on C# a dead end or is it possible to make it work?

          Stian
          I do everything in C#

          Comment

          Working...
          X