ScriptUO
Scripting Resources & Utilities => Stealth Client => Stealth archive => Topic started by: slyone on November 20, 2013, 06:08:35 PM
-
My project builds fine and the first print statement prints "Begin" to the console but then an exception is thrown when I call:
Console.WriteLine("Hex value from ScriptDotNet: {0:X}", Stealth.Script_GetSelfID());
The exception I get shows the following:
An unhandled exception of type 'System.TypeInitializationException' occurred in csSteathScripts.exe
Additional information: The type initializer for 'ScriptDotNet.Stealth' threw an exception.
I'm using VS2012 with .NET 4.5 and the latest ScriptDotNet.dll.
Is it something I am doing wrong? Has anyone else encountered this problem?
My Program.cs is below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ScriptDotNet;
using ScriptAPI;
namespace csSteathScripts
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Begin");
Console.WriteLine("Hex value from ScriptDotNet: {0:X}", Stealth.Script_GetSelfID());
Console.WriteLine("Hex value from ScriptAPI: {0:X}", Self.ID);
Console.WriteLine("All done");
}
}
}
-
I also tried using Boydon's py_stealth.py wrapper and Stealth still seems to crash.
I'm using Stealth 6.1.4 in both instances.
I'm using Python 2.7 here.
from py_stealth import stealth_dll
print "%x" %(stealth_dll.Script_GetSelfID())
from py_stealth import Self
print "%x" %(Self())
-
I tested... works fine. Are you running ScriptDotNet.DLL that i uploaded yesterday? If not, try it.
That exception happens in static classes ... need more information though.
Recommendations :
1. Wrap the line in a try/catch
2. Make sure you're running the program in the debugger (hit PLAY button) so you can see what's going on
try
{
Console.WriteLine("Hex value from ScriptDotNet: {0:X}", Stealth.Script_GetSelfID());
}
catch (TypeInitializationException ex)
{
Trace.WriteLine(ex.InnerException); // System.Diagnostics
throw;
}
-
My project builds fine and the first print statement prints "Begin" to the console but then an exception is thrown when I call:
Console.WriteLine("Hex value from ScriptDotNet: {0:X}", Stealth.Script_GetSelfID());
The exception I get shows the following:
An unhandled exception of type 'System.TypeInitializationException' occurred in csSteathScripts.exe
Additional information: The type initializer for 'ScriptDotNet.Stealth' threw an exception.
I'm using VS2012 with .NET 4.5 and the latest ScriptDotNet.dll.
Is it something I am doing wrong? Has anyone else encountered this problem?
My Program.cs is below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ScriptDotNet;
using ScriptAPI;
namespace csSteathScripts
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Begin");
Console.WriteLine("Hex value from ScriptDotNet: {0:X}", Stealth.Script_GetSelfID());
Console.WriteLine("Hex value from ScriptAPI: {0:X}", Self.ID);
Console.WriteLine("All done");
}
}
}
Run Visual Studio as Administrator, if you try to call your application from vs.
I always getting this error, when i forget to run vs2013 without adminrights.
-
Thanks for the replies.
I tested... works fine. Are you running ScriptDotNet.DLL that i uploaded yesterday? If not, try it.
That exception happens in static classes ... need more information though.
Recommendations :
1. Wrap the line in a try/catch
2. Make sure you're running the program in the debugger (hit PLAY button) so you can see what's going on
try
{
Console.WriteLine("Hex value from ScriptDotNet: {0:X}", Stealth.Script_GetSelfID());
}
catch (TypeInitializationException ex)
{
Trace.WriteLine(ex.InnerException); // System.Diagnostics
throw;
}
I added in your try catch. When I debug through the program, the exception doesn't get thrown. When I try to run the executable from the command prompt, I get the following exception.
Unhandled Exception: System.TypeInitializationException: The type initializer for 'ScriptDotNet.Stealth' threw an exception. ---> System.TimeoutExcept
ion: The operation has timed out.
at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout)
at ScriptDotNet.Stealth..cctor()
--- End of inner exception stack trace ---
at ScriptDotNet.Stealth.Script_GetSelfID()
at csSteathScripts.Program.Main(String[] args) in c:\StealthUOClient\csSteathScripts\csSteathScripts\Program.cs:line 25
In order to not get the exception, I had to run the command prompt as Administrator.
I haven't figured why my Python version crashes...
Is there a way you could compile the ScriptDotNet.dll with .NET 4 instead of .NET 4.5 so that I can run it on my XP machine?
-
In order to not get the exception, I had to run the command prompt as Administrator.
I haven't figured why my Python version crashes...
Is there a way you could compile the ScriptDotNet.dll with .NET 4 instead of .NET 4.5 so that I can run it on my XP machine?
I tried to simply change the target framework, but very strange things start happening and the DLL does not function correctly.
My time these days is very limited, so I can't promise when, but I'll try again at some point.
-
In order to not get the exception, I had to run the command prompt as Administrator.
I haven't figured why my Python version crashes...
Is there a way you could compile the ScriptDotNet.dll with .NET 4 instead of .NET 4.5 so that I can run it on my XP machine?
I tried to simply change the target framework, but very strange things start happening and the DLL does not function correctly.
My time these days is very limited, so I can't promise when, but I'll try again at some point.
Thanks for trying.