Page 1 of 1
How do I code this?
Posted:
September 19th, 2014, 4:24 pm
by Ajay Askoolum
I do not have a clue about getting CSE to understand the line shown in bold below; any hints?
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Security;
using System.Security.Permissions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Management;
[assembly: AllowPartiallyTrustedCallers]
namespace WinMgmt
Re: How do I code this?
Posted:
October 8th, 2014, 1:34 am
by joe_blaze
Hi Ajay,
You are asking how can you direct the CSE to execute compiler instructions like [assembly: AllowPartiallyTrustedCallers].
This is an assembly attributes and is not a separately-executable C# statement.
This assembly attribute is actually a compiler directive that will only be acted upon when the C# source code for an assembly is compiled by the Microsoft JIT compiler.
The CSE is designed to provide the APL+Win programmer the ability to execute C# executable statements.
The CSE is effectively a line-by-line C# statement interpreter based on the Microsoft Roslyn technology.
When the CSE 'Init' method is used the C# side of the CSE creates an in-memory assembly.
The APL+Win/CSE programmer cannot modify the attributes of that in-memory assembly.
When assembly or module attributes are needed, I suggest that you use Visual Studio to create your assembly, build it, giving it a 'strong' name if you are using the AllowPartiallyTrustedCallers assembly attribute, and then use the CSE 'LoadAssembly' method to load the assembly into the context of a CSE instance.
Joe Blaze
Re: How do I code this?
Posted:
October 30th, 2014, 4:40 pm
by Ajay Askoolum
Thanks Joe.
I think I understand why []cse cannot abide compiler instructions. However, it appears to understand some attributes
when you exec a block of code e.g.
[ComImport()]
Could you verify and confirm, please?
Re: How do I code this?
Posted:
October 30th, 2014, 5:39 pm
by joe_blaze
Hi Ajay,
To speed up my research into this question, please provide me with a code example which runs in Visual Studio. I will test that and try to 'translate' that to a CSE script.
Joe