ERR_UNLOADED = 103,
ERR_NO_INVOCATION = 104,
ABSENT_INFORMATION = 105,
- NO_SEQ_POINT_AT_IL_OFFSET = 106
+ NO_SEQ_POINT_AT_IL_OFFSET = 106,
+ INVOKE_ABORTED = 107
}
public class ErrorHandlerEventArgs : EventArgs {
* with newer runtimes, and vice versa.
*/
internal const int MAJOR_VERSION = 2;
- internal const int MINOR_VERSION = 39;
+ internal const int MINOR_VERSION = 42;
enum WPSuspendPolicy {
NONE = 0,
return res;
}
+ public string ReadUTF16String () {
+ int len = decode_int (packet, ref offset);
+ string res = new String (Encoding.Unicode.GetChars (packet, offset, len));
+ offset += len;
+ return res;
+ }
+
public ValueImpl ReadValue () {
ElementType etype = (ElementType)ReadByte ();
bool disconnected;
+ internal ManualResetEvent DisconnectedEvent = new ManualResetEvent (false);
+
void receiver_thread_main () {
while (!closed) {
try {
lock (reply_packets_monitor) {
disconnected = true;
+ DisconnectedEvent.Set ();
Monitor.PulseAll (reply_packets_monitor);
TransportClose ();
}
SendReceive (CommandSet.VM, (int)CmdVM.SET_PROTOCOL_VERSION, new PacketWriter ().WriteInt (major).WriteInt (minor));
}
- internal long[] VM_GetThreads () {
- var res = SendReceive (CommandSet.VM, (int)CmdVM.ALL_THREADS, null);
- int len = res.ReadInt ();
- long[] arr = new long [len];
- for (int i = 0; i < len; ++i)
- arr [i] = res.ReadId ();
- return arr;
+ internal void VM_GetThreads (Action<long[]> resultCallaback) {
+ Send (CommandSet.VM, (int)CmdVM.ALL_THREADS, null, (res) => {
+ int len = res.ReadInt ();
+ long[] arr = new long [len];
+ for (int i = 0; i < len; ++i)
+ arr [i] = res.ReadId ();
+ resultCallaback(arr);
+ }, 1);
}
internal void VM_Suspend () {
* STRINGS
*/
internal string String_GetValue (long id) {
- return SendReceive (CommandSet.STRING_REF, (int)CmdStringRef.GET_VALUE, new PacketWriter ().WriteId (id)).ReadString ();
+ var r = SendReceive (CommandSet.STRING_REF, (int)CmdStringRef.GET_VALUE, new PacketWriter ().WriteId (id));
+
+ bool is_utf16 = false;
+ if (Version.AtLeast (2, 41))
+ is_utf16 = r.ReadByte () == 1;
+
+ if (is_utf16)
+ return r.ReadUTF16String ();
+ else
+ return r.ReadString ();
}
internal int String_GetLength (long id) {
{
closed = true;
disconnected = true;
+ DisconnectedEvent.Set ();
TransportClose ();
}
}