I'm having trouble getting a C# script to run where I need to use a class from System.Net. The script is attached with a .txt extension.
The error I get is:
Compiling script P:\Program Files (x86)\HomeSeer HS3\scripts\GetCurrentWeather.cs: {interactive}(3,14): error CS1001: Unexpected symbol `(', expecting identifier {interactive}(3,35): error CS1530: Keyword `new' is not allowed on namespace elements {interactive}(3,38): error CS1001: Unexpected symbol `WebClient', expecting identifier {interactive}(1,2): warning CS0105: The using directive for `System.Net' appeared previously in this namespace
It seems like the "using" statement is causing problems. However, if I remove it, I get all sorts of errors like this:
Compiling script P:\Program Files (x86)\HomeSeer HS3\scripts\GetCurrentWeather.cs: {interactive}(4,6): error CS1525: Unexpected symbol `System', expecting `(' {interactive}(4,7): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement {interactive}(5,6): error CS1525: Unexpected symbol `System', expecting `(' {interactive}(5,14): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement {interactive}(6,6): error CS1525: Unexpected symbol `Scheduler', expecting `(' {interactive}(6,7): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement {interactive}(7,6): error CS1525: Unexpected symbol `HomeSeerAPI', expecting `(' {interactive}(7,7): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement {interactive}(8,0): error CS1525: Unexpected symbol `public', expecting `(' {interactive}(8,20): error CS1525: Unexpected symbol `{', expecting `(' {interactive}(10,2): error CS1525: Unexpected symbol `public' {interactive}(10,10): error CS1547: Keyword `void' cannot be used in this context {interactive}(10,20): error CS1525: Unexpected symbol `(' {interactive}(17,0): error CS1525: Unexpected symbol `public' {interactive}(17,8): error CS1547: Keyword `void' cannot be used in this context {interactive}(17,16): error CS1525: Unexpected symbol `(' {interactive}(31,5): error CS1524: Expected catch or finally {interactive}(44,4): error CS1525: Unexpected symbol `catch', expecting `catch' or `finally' {interactive}(48,4): error CS1525: Unexpected symbol `}', expecting `catch' or `finally' {interactive}(55,37): error CS8025: Parsing error
Which include messages about HomeSeerAPI, Scheduler and more.
I need to see what the full generated C# code is to try to make more sense of what's going on. If I take my script and wrap it in a normal C# environment (commenting out the hs.WriteLog statements), it runs just fine. I think something is wrong with my HS3 setup.
I'm getting very frustrated by this as I've got a whole bunch of C# script work planned.
Help please.
The error I get is:
Compiling script P:\Program Files (x86)\HomeSeer HS3\scripts\GetCurrentWeather.cs: {interactive}(3,14): error CS1001: Unexpected symbol `(', expecting identifier {interactive}(3,35): error CS1530: Keyword `new' is not allowed on namespace elements {interactive}(3,38): error CS1001: Unexpected symbol `WebClient', expecting identifier {interactive}(1,2): warning CS0105: The using directive for `System.Net' appeared previously in this namespace
It seems like the "using" statement is causing problems. However, if I remove it, I get all sorts of errors like this:
Compiling script P:\Program Files (x86)\HomeSeer HS3\scripts\GetCurrentWeather.cs: {interactive}(4,6): error CS1525: Unexpected symbol `System', expecting `(' {interactive}(4,7): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement {interactive}(5,6): error CS1525: Unexpected symbol `System', expecting `(' {interactive}(5,14): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement {interactive}(6,6): error CS1525: Unexpected symbol `Scheduler', expecting `(' {interactive}(6,7): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement {interactive}(7,6): error CS1525: Unexpected symbol `HomeSeerAPI', expecting `(' {interactive}(7,7): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement {interactive}(8,0): error CS1525: Unexpected symbol `public', expecting `(' {interactive}(8,20): error CS1525: Unexpected symbol `{', expecting `(' {interactive}(10,2): error CS1525: Unexpected symbol `public' {interactive}(10,10): error CS1547: Keyword `void' cannot be used in this context {interactive}(10,20): error CS1525: Unexpected symbol `(' {interactive}(17,0): error CS1525: Unexpected symbol `public' {interactive}(17,8): error CS1547: Keyword `void' cannot be used in this context {interactive}(17,16): error CS1525: Unexpected symbol `(' {interactive}(31,5): error CS1524: Expected catch or finally {interactive}(44,4): error CS1525: Unexpected symbol `catch', expecting `catch' or `finally' {interactive}(48,4): error CS1525: Unexpected symbol `}', expecting `catch' or `finally' {interactive}(55,37): error CS8025: Parsing error
Which include messages about HomeSeerAPI, Scheduler and more.
I need to see what the full generated C# code is to try to make more sense of what's going on. If I take my script and wrap it in a normal C# environment (commenting out the hs.WriteLog statements), it runs just fine. I think something is wrong with my HS3 setup.
I'm getting very frustrated by this as I've got a whole bunch of C# script work planned.
Help please.
Comment