本文整理汇总了C#中Iodine.Runtime.VirtualMachine.Trace方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualMachine.Trace方法的具体用法?C# VirtualMachine.Trace怎么用?C# VirtualMachine.Trace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Iodine.Runtime.VirtualMachine
的用法示例。
在下文中一共展示了VirtualMachine.Trace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
if (args.Length == 0) {
ReplShell shell = new ReplShell ();
shell.Run ();
Environment.Exit (0);
}
IodineOptions options = IodineOptions.Parse (args);
if (options.ShowVersion) {
int major = Assembly.GetExecutingAssembly ().GetName ().Version.Major;
int minor = Assembly.GetExecutingAssembly ().GetName ().Version.Minor;
int patch = Assembly.GetExecutingAssembly ().GetName ().Version.Build;
Console.WriteLine ("Iodine v{0}.{1}.{2}-alpha", major, minor, patch);
Environment.Exit (0);
}
ErrorLog errorLog = new ErrorLog ();
IodineModule module = IodineModule.LoadModule (errorLog, options.FileName);
if (module == null) {
DisplayErrors (errorLog);
Panic ("Compilation failed with {0} errors!", errorLog.ErrorCount);
} else {
VirtualMachine vm = new VirtualMachine ();
try {
module.Invoke (vm, new IodineObject[] { });
if (module.HasAttribute ("main")) {
module.GetAttribute ("main").Invoke (vm, new IodineObject[] { options.Arguments });
}
} catch (UnhandledIodineExceptionException ex) {
Console.Error.WriteLine ("An unhandled {0} has occured!", ex.OriginalException.TypeDef.Name);
Console.Error.WriteLine ("\tMessage: {0}", ex.OriginalException.GetAttribute ("message").ToString ());
Console.WriteLine ();
ex.PrintStack ();
Console.Error.WriteLine ();
Panic ("Program terminated.");
} catch (SyntaxException ex) {
DisplayErrors (ex.ErrorLog);
Panic ("Compilation failed with {0} errors!", ex.ErrorLog.ErrorCount);
} catch (Exception e) {
Console.Error.WriteLine ("Fatal exception has occured!");
Console.Error.WriteLine (e.Message);
Console.Error.WriteLine ("Stack trace: \n{0}", e.StackTrace);
Console.Error.WriteLine ("\nIodine stack trace \n{0}", vm.Trace ());
Panic ("Program terminated.");
}
}
}