Can I debug a script that I send global items to it using ScriptGlobalClass?
Is that I am getting a System.NullReferenceException error
I'm using your Remote Debugging sample application
In this method I send a global item:
private bool CompileScript()
if (edit.Modified)

scriptRun.GlobalItems.Add(new ScriptGlobalItem("x", typeof(teste), x)); <=====

if (!scriptRun.Compiled)
if (!scriptRun.Compile())
return false;

return true;
Inside Script:

public static void Main(string[] args)
{ = "Rogerio"; <====
string ipcPortName;
string ipcObjectUri;
Can I debug scripts that run internally in my application where I need to send objects that will be modified by the script?
What is the best way to do this?
Hi Rogerio,
With debugger you can either incorporate debug logic into your application, or use stand-alone script debugging tool to debug scripts in your application. DebudMyScript quick start project shows how to implement second approach.
In case you need to incorporate debugging logic into your application, the script will need to be compiled as executable(because debugger and debugee should be two separate processes). In case your script need to access application-defined objects, it has then to use inter-process communities techniques(.net remoting). This is demonstrated in DebugRemoteScript example.
Please also refer to this article, which describes this in a bit more depth:
I would also suggest to take a look at the TypeScript Scripter, which allows to have both script and debugger be part of the same application process.