more G-Labs products

Author Topic: C# script need using statements?  (Read 2212 times)

September 24, 2014, 04:43:34 PM
Read 2212 times

jarrettv

  • *
  • Information
  • Newbie
  • Posts: 13
(https://dl.dropboxusercontent.com/u/6142956/forums/Csharpupdateissue.png)

I'm running on a BBB debian with the mono-runtime from rasbian.

September 24, 2014, 04:57:05 PM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I don't believe you can use "using" statements in C# scripts.  You can declare variables with the same code, though.  I'm a C# hacker (can only write based on code examples), so I couldn't show you what to do from scratch.

September 24, 2014, 08:10:21 PM
Reply #2

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi Ben,

this is fixed in next release. You can't use pragma like that. I placed them at the very beginning of the app wrapper (that cannot be modified from web editor).

g.

September 24, 2014, 08:13:58 PM
Reply #3

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Well, never mind it works =)
Anyway this will be default behaviour with next release, so no need to add pragma.

g.

September 24, 2014, 08:20:59 PM
Reply #4

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi jarrettv,

the problem is the way system libraries are referenced:

https://github.com/genielabs/HomeGenie/blob/master/HomeGenie/Automation/CSharpAppFactory.cs#L140

This "if" block decide how to load the libraries. Perhaps, for some reason, on BBB the variable "relocateSystemAsm" is not true.

g.


October 09, 2014, 12:04:07 AM
Reply #5

jarrettv

  • *
  • Information
  • Newbie
  • Posts: 13
Hi Gene, I was able to test this with a simple console application. Code is here:

https://gist.github.com/jarrettv/19ee88c0549f32dc8025

Here is the output on my BBB:

Code: [Select]
debian@arm:~$ sudo mono BbbAsmTest.exe
-----------------
/usr/local/lib/mono/4.5/mscorlib.dll
/home/debian/BbbAsmTest.exe
------------------Count=2
Testing linq: 3
-----------------
/usr/local/lib/mono/4.5/mscorlib.dll
/home/debian/BbbAsmTest.exe
/usr/local/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll
------------------Count=3
Test compiling code
Mono.Runtime
3.4.1 (master/148b100 Sun Mar 30 09:59:44 UTC 2014)
Relocate:True
Compile=0,test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
-----------------
/usr/local/lib/mono/4.5/mscorlib.dll
/home/debian/BbbAsmTest.exe
/usr/local/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll
/usr/local/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll

------------------Count=5

It shows the correct relocateSystemAsm value. I suppose the next step would be add some debug statements into HomeGenie.

Any other ideas?

October 14, 2014, 08:00:15 PM
Reply #6

jarrettv

  • *
  • Information
  • Newbie
  • Posts: 13
Gene, I submitted a pull request. I think your flag is backwards.