Imported Upstream version 4.2.0.207
Former-commit-id: f90f74cb984aa12eac8e2a357db43169ae7378e5
This commit is contained in:
parent
6992685b86
commit
afe402035c
@ -84,8 +84,8 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
|||||||
$(top_srcdir)/configure $(am__configure_deps) \
|
$(top_srcdir)/configure $(am__configure_deps) \
|
||||||
$(srcdir)/config.h.in mkinstalldirs \
|
$(srcdir)/config.h.in mkinstalldirs \
|
||||||
$(srcdir)/mono-uninstalled.pc.in COPYING.LIB ChangeLog NEWS \
|
$(srcdir)/mono-uninstalled.pc.in COPYING.LIB ChangeLog NEWS \
|
||||||
compile config.guess config.rpath config.sub install-sh \
|
compile config.guess config.rpath config.sub depcomp \
|
||||||
missing ltmain.sh
|
install-sh missing ltmain.sh
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \
|
am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \
|
||||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||||
|
@ -48,7 +48,7 @@ namespace System.Runtime.ExceptionServices {
|
|||||||
if (count != 0)
|
if (count != 0)
|
||||||
Array.Copy (exception.captured_traces, 0, stack_traces, 0, count);
|
Array.Copy (exception.captured_traces, 0, stack_traces, 0, count);
|
||||||
|
|
||||||
stack_traces [count] = new System.Diagnostics.StackTrace (exception, 0, true, true);
|
stack_traces [count] = new System.Diagnostics.StackTrace (exception, 0, true);
|
||||||
m_stackTrace = stack_traces;
|
m_stackTrace = stack_traces;
|
||||||
#else
|
#else
|
||||||
m_remoteStackTrace = exception.RemoteStackTrace;
|
m_remoteStackTrace = exception.RemoteStackTrace;
|
||||||
|
@ -417,7 +417,7 @@ namespace Mono.Debugger.Soft
|
|||||||
* with newer runtimes, and vice versa.
|
* with newer runtimes, and vice versa.
|
||||||
*/
|
*/
|
||||||
internal const int MAJOR_VERSION = 2;
|
internal const int MAJOR_VERSION = 2;
|
||||||
internal const int MINOR_VERSION = 40;
|
internal const int MINOR_VERSION = 41;
|
||||||
|
|
||||||
enum WPSuspendPolicy {
|
enum WPSuspendPolicy {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
@ -801,6 +801,13 @@ namespace Mono.Debugger.Soft
|
|||||||
return res;
|
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 () {
|
public ValueImpl ReadValue () {
|
||||||
ElementType etype = (ElementType)ReadByte ();
|
ElementType etype = (ElementType)ReadByte ();
|
||||||
|
|
||||||
@ -2418,7 +2425,16 @@ namespace Mono.Debugger.Soft
|
|||||||
* STRINGS
|
* STRINGS
|
||||||
*/
|
*/
|
||||||
internal string String_GetValue (long id) {
|
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) {
|
internal int String_GetLength (long id) {
|
||||||
|
@ -598,7 +598,7 @@ public class Tests : TestsBase, ITest2
|
|||||||
public static void arguments () {
|
public static void arguments () {
|
||||||
arg1 (SByte.MaxValue - 5, Byte.MaxValue - 5, true, Int16.MaxValue - 5, UInt16.MaxValue - 5, 'F', Int32.MaxValue - 5, UInt32.MaxValue - 5, Int64.MaxValue - 5, UInt64.MaxValue - 5, 1.2345f, 6.78910, new IntPtr (Int32.MaxValue - 5), new UIntPtr (UInt32.MaxValue - 5));
|
arg1 (SByte.MaxValue - 5, Byte.MaxValue - 5, true, Int16.MaxValue - 5, UInt16.MaxValue - 5, 'F', Int32.MaxValue - 5, UInt32.MaxValue - 5, Int64.MaxValue - 5, UInt64.MaxValue - 5, 1.2345f, 6.78910, new IntPtr (Int32.MaxValue - 5), new UIntPtr (UInt32.MaxValue - 5));
|
||||||
int i = 42;
|
int i = 42;
|
||||||
arg2 ("FOO", null, "BLA", ref i, new GClass <int> { field = 42 }, new object ());
|
arg2 ("FOO", null, "BLA", ref i, new GClass <int> { field = 42 }, new object (), '\0'.ToString () + "A");
|
||||||
Tests t = new Tests () { field_i = 42, field_s = "S" };
|
Tests t = new Tests () { field_i = 42, field_s = "S" };
|
||||||
t.arg3 ("BLA");
|
t.arg3 ("BLA");
|
||||||
}
|
}
|
||||||
@ -609,7 +609,7 @@ public class Tests : TestsBase, ITest2
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||||
public static string arg2 (string s, string s3, object o, ref int i, GClass <int> gc, object o2) {
|
public static string arg2 (string s, string s3, object o, ref int i, GClass <int> gc, object o2, string s4) {
|
||||||
return s + (s3 != null ? "" : "") + o + i + gc.field + o2;
|
return s + (s3 != null ? "" : "") + o + i + gc.field + o2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -908,6 +908,10 @@ public class Tests : TestsBase, ITest2
|
|||||||
public void invoke2 () {
|
public void invoke2 () {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||||
|
public void invoke3 () {
|
||||||
|
}
|
||||||
|
|
||||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||||
public void invoke_ex () {
|
public void invoke_ex () {
|
||||||
invoke_ex_inner ();
|
invoke_ex_inner ();
|
||||||
|
@ -1 +1 @@
|
|||||||
641fefd2afe9c647385e3ad22f0e18a355ee6f2e
|
3c62a78ee4f20b1751753ce79842028dd874ffad
|
@ -118,6 +118,7 @@ namespace MonoTests.Mono.Unix {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
[Category ("AndroidNotWorking")] // Crashes (silently) the runtime in similar fashion to real-time signals
|
||||||
public void TestSignumProperty ()
|
public void TestSignumProperty ()
|
||||||
{
|
{
|
||||||
UnixSignal signal1 = new UnixSignal (Signum.SIGSEGV);
|
UnixSignal signal1 = new UnixSignal (Signum.SIGSEGV);
|
||||||
|
@ -461,8 +461,6 @@ namespace System.ServiceModel.MonoInternal
|
|||||||
if (p == parameters)
|
if (p == parameters)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (p.Length != parameters.Length)
|
|
||||||
throw new InvalidOperationException ();
|
|
||||||
Array.Copy (p, parameters, p.Length);
|
Array.Copy (p, parameters, p.Length);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,7 @@ System.ServiceModel.Description/WsdlImporterTest.cs
|
|||||||
System.ServiceModel.Dispatcher/ActionFilterTest.cs
|
System.ServiceModel.Dispatcher/ActionFilterTest.cs
|
||||||
System.ServiceModel.Dispatcher/Bug652331Test.cs
|
System.ServiceModel.Dispatcher/Bug652331Test.cs
|
||||||
System.ServiceModel.Dispatcher/Bug652331_2Test.cs
|
System.ServiceModel.Dispatcher/Bug652331_2Test.cs
|
||||||
|
System.ServiceModel.Dispatcher/Bug32886Test.cs
|
||||||
System.ServiceModel.Dispatcher/ChannelDispatcherTest.cs
|
System.ServiceModel.Dispatcher/ChannelDispatcherTest.cs
|
||||||
System.ServiceModel.Dispatcher/DispatchOperationTest.cs
|
System.ServiceModel.Dispatcher/DispatchOperationTest.cs
|
||||||
System.ServiceModel.Dispatcher/DispatchRuntimeTest.cs
|
System.ServiceModel.Dispatcher/DispatchRuntimeTest.cs
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -170,9 +170,16 @@ namespace System {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When used instead of UriKind.RelativeOrAbsolute paths such as "/foo" are assumed relative.
|
||||||
|
const UriKind DotNetRelativeOrAbsolute = (UriKind) 300;
|
||||||
|
|
||||||
public Uri (string uriString, UriKind uriKind)
|
public Uri (string uriString, UriKind uriKind)
|
||||||
{
|
{
|
||||||
source = uriString;
|
source = uriString;
|
||||||
|
|
||||||
|
if (uriString != null && uriKind == DotNetRelativeOrAbsolute)
|
||||||
|
uriKind = (uriString.StartsWith ("/", StringComparison.Ordinal))? UriKind.Relative : UriKind.RelativeOrAbsolute;
|
||||||
|
|
||||||
ParseUri (uriKind);
|
ParseUri (uriKind);
|
||||||
|
|
||||||
switch (uriKind) {
|
switch (uriKind) {
|
||||||
@ -205,6 +212,9 @@ namespace System {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (uriKind == DotNetRelativeOrAbsolute)
|
||||||
|
uriKind = (uriString.StartsWith ("/", StringComparison.Ordinal))? UriKind.Relative : UriKind.RelativeOrAbsolute;
|
||||||
|
|
||||||
if (uriKind != UriKind.RelativeOrAbsolute &&
|
if (uriKind != UriKind.RelativeOrAbsolute &&
|
||||||
uriKind != UriKind.Absolute &&
|
uriKind != UriKind.Absolute &&
|
||||||
uriKind != UriKind.Relative) {
|
uriKind != UriKind.Relative) {
|
||||||
|
@ -48,7 +48,7 @@ namespace MonoTests.System.Net.WebSockets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||||
public void ServerHandshakeReturnCrapStatusCodeTest ()
|
public void ServerHandshakeReturnCrapStatusCodeTest ()
|
||||||
{
|
{
|
||||||
// On purpose,
|
// On purpose,
|
||||||
@ -65,7 +65,7 @@ namespace MonoTests.System.Net.WebSockets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||||
public void ServerHandshakeReturnWrongUpgradeHeader ()
|
public void ServerHandshakeReturnWrongUpgradeHeader ()
|
||||||
{
|
{
|
||||||
#pragma warning disable 4014
|
#pragma warning disable 4014
|
||||||
@ -84,7 +84,7 @@ namespace MonoTests.System.Net.WebSockets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||||
public void ServerHandshakeReturnWrongConnectionHeader ()
|
public void ServerHandshakeReturnWrongConnectionHeader ()
|
||||||
{
|
{
|
||||||
#pragma warning disable 4014
|
#pragma warning disable 4014
|
||||||
@ -105,7 +105,7 @@ namespace MonoTests.System.Net.WebSockets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Category ("AndroidNotWorking")] // The test hangs when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
[Category ("MobileNotWorking")] // The test hangs when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||||
public void EchoTest ()
|
public void EchoTest ()
|
||||||
{
|
{
|
||||||
const string Payload = "This is a websocket test";
|
const string Payload = "This is a websocket test";
|
||||||
@ -130,7 +130,7 @@ namespace MonoTests.System.Net.WebSockets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||||
public void CloseOutputAsyncTest ()
|
public void CloseOutputAsyncTest ()
|
||||||
{
|
{
|
||||||
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
|
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
|
||||||
@ -147,7 +147,7 @@ namespace MonoTests.System.Net.WebSockets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||||
public void CloseAsyncTest ()
|
public void CloseAsyncTest ()
|
||||||
{
|
{
|
||||||
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
|
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
|
||||||
@ -164,7 +164,7 @@ namespace MonoTests.System.Net.WebSockets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test, ExpectedException (typeof (ArgumentNullException))]
|
[Test, ExpectedException (typeof (ArgumentNullException))]
|
||||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||||
public void SendAsyncArgTest_NoArray ()
|
public void SendAsyncArgTest_NoArray ()
|
||||||
{
|
{
|
||||||
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
|
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
|
||||||
@ -178,7 +178,7 @@ namespace MonoTests.System.Net.WebSockets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test, ExpectedException (typeof (ArgumentNullException))]
|
[Test, ExpectedException (typeof (ArgumentNullException))]
|
||||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||||
public void ReceiveAsyncArgTest_NoArray ()
|
public void ReceiveAsyncArgTest_NoArray ()
|
||||||
{
|
{
|
||||||
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
|
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
|
||||||
@ -186,7 +186,7 @@ namespace MonoTests.System.Net.WebSockets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||||
public void ReceiveAsyncWrongState_Closed ()
|
public void ReceiveAsyncWrongState_Closed ()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -201,7 +201,7 @@ namespace MonoTests.System.Net.WebSockets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||||
public void SendAsyncWrongState_Closed ()
|
public void SendAsyncWrongState_Closed ()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -216,7 +216,7 @@ namespace MonoTests.System.Net.WebSockets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
|
||||||
public void SendAsyncWrongState_CloseSent ()
|
public void SendAsyncWrongState_CloseSent ()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -1940,6 +1940,20 @@ namespace MonoTests.System
|
|||||||
Assert.AreEqual ("id=1%262&sort=asc", escaped, "UriEscaped");
|
Assert.AreEqual ("id=1%262&sort=asc", escaped, "UriEscaped");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When used, paths such as "/foo" are assumed relative.
|
||||||
|
static UriKind DotNetRelativeOrAbsolute = (Type.GetType ("Mono.Runtime") == null)? UriKind.RelativeOrAbsolute : (UriKind) 300;
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void DotNetRelativeOrAbsoluteTest ()
|
||||||
|
{
|
||||||
|
var uri1 = new Uri ("/foo", DotNetRelativeOrAbsolute);
|
||||||
|
Assert.IsFalse (uri1.IsAbsoluteUri);
|
||||||
|
|
||||||
|
Uri uri2;
|
||||||
|
Uri.TryCreate("/foo", DotNetRelativeOrAbsolute, out uri2);
|
||||||
|
Assert.IsFalse (uri2.IsAbsoluteUri);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
// Bug #12631
|
// Bug #12631
|
||||||
public void LocalPathWithBaseUrl ()
|
public void LocalPathWithBaseUrl ()
|
||||||
|
@ -120,11 +120,6 @@ namespace System.Diagnostics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public StackTrace (Exception e, int skipFrames, bool fNeedFileInfo)
|
public StackTrace (Exception e, int skipFrames, bool fNeedFileInfo)
|
||||||
: this (e, skipFrames, fNeedFileInfo, false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
internal StackTrace (Exception e, int skipFrames, bool fNeedFileInfo, bool returnNativeFrames)
|
|
||||||
{
|
{
|
||||||
if (e == null)
|
if (e == null)
|
||||||
throw new ArgumentNullException ("e");
|
throw new ArgumentNullException ("e");
|
||||||
@ -133,23 +128,6 @@ namespace System.Diagnostics {
|
|||||||
|
|
||||||
frames = get_trace (e, skipFrames, fNeedFileInfo);
|
frames = get_trace (e, skipFrames, fNeedFileInfo);
|
||||||
|
|
||||||
if (!returnNativeFrames) {
|
|
||||||
bool resize = false;
|
|
||||||
for (int i = 0; i < frames.Length; ++i)
|
|
||||||
if (frames [i].GetMethod () == null)
|
|
||||||
resize = true;
|
|
||||||
|
|
||||||
if (resize) {
|
|
||||||
var l = new List<StackFrame> ();
|
|
||||||
|
|
||||||
for (int i = 0; i < frames.Length; ++i)
|
|
||||||
if (frames [i].GetMethod () != null)
|
|
||||||
l.Add (frames [i]);
|
|
||||||
|
|
||||||
frames = l.ToArray ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
captured_traces = e.captured_traces;
|
captured_traces = e.captured_traces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ namespace System
|
|||||||
/* Not thrown yet */
|
/* Not thrown yet */
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
StackTrace st = new StackTrace (this, 0, true, true);
|
StackTrace st = new StackTrace (this, 0, true);
|
||||||
return stack_trace = st.ToString ();
|
return stack_trace = st.ToString ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -298,6 +298,7 @@ namespace System
|
|||||||
{
|
{
|
||||||
captured_traces = (StackTrace[]) exceptionDispatchInfo.BinaryStackTraceArray;
|
captured_traces = (StackTrace[]) exceptionDispatchInfo.BinaryStackTraceArray;
|
||||||
trace_ips = null;
|
trace_ips = null;
|
||||||
|
stack_trace = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -12,6 +12,8 @@ using System.Reflection;
|
|||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.ExceptionServices;
|
||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
@ -477,6 +479,104 @@ namespace MonoTests.System.Reflection.Emit
|
|||||||
public string Name;
|
public string Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ExceptionHandling_Test_Support
|
||||||
|
{
|
||||||
|
public static Exception Caught;
|
||||||
|
public static string CaughtStackTrace;
|
||||||
|
|
||||||
|
public static void ThrowMe ()
|
||||||
|
{
|
||||||
|
Caught = null;
|
||||||
|
CaughtStackTrace = null;
|
||||||
|
throw new Exception("test");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Handler (Exception e)
|
||||||
|
{
|
||||||
|
Caught = e;
|
||||||
|
CaughtStackTrace = e.StackTrace.ToString ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ExceptionHandling ()
|
||||||
|
{
|
||||||
|
var method = new DynamicMethod ("", typeof(void), new[] { typeof(int) }, typeof (DynamicMethodTest));
|
||||||
|
var ig = method.GetILGenerator ();
|
||||||
|
|
||||||
|
ig.BeginExceptionBlock();
|
||||||
|
ig.Emit(OpCodes.Call, typeof(ExceptionHandling_Test_Support).GetMethod("ThrowMe"));
|
||||||
|
|
||||||
|
ig.BeginCatchBlock(typeof(Exception));
|
||||||
|
ig.Emit(OpCodes.Call, typeof(ExceptionHandling_Test_Support).GetMethod("Handler"));
|
||||||
|
ig.EndExceptionBlock();
|
||||||
|
|
||||||
|
ig.Emit(OpCodes.Ret);
|
||||||
|
|
||||||
|
var invoke = (Action<int>) method.CreateDelegate (typeof(Action<int>));
|
||||||
|
invoke (456324);
|
||||||
|
|
||||||
|
Assert.IsNotNull (ExceptionHandling_Test_Support.Caught, "#1");
|
||||||
|
Assert.AreEqual (2, ExceptionHandling_Test_Support.CaughtStackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.None).Length, "#2");
|
||||||
|
|
||||||
|
var st = new StackTrace (ExceptionHandling_Test_Support.Caught, 0, true);
|
||||||
|
|
||||||
|
// Caught stack trace when dynamic method is gone
|
||||||
|
Assert.AreEqual (ExceptionHandling_Test_Support.CaughtStackTrace, st.ToString (), "#3");
|
||||||
|
|
||||||
|
// Catch handler stack trace inside dynamic method match
|
||||||
|
Assert.AreEqual (ExceptionHandling_Test_Support.Caught.StackTrace, st.ToString (), "#4");
|
||||||
|
}
|
||||||
|
|
||||||
|
class ExceptionHandlingWithExceptionDispatchInfo_Test_Support
|
||||||
|
{
|
||||||
|
public static Exception Caught;
|
||||||
|
public static string CaughtStackTrace;
|
||||||
|
|
||||||
|
public static void ThrowMe ()
|
||||||
|
{
|
||||||
|
Caught = null;
|
||||||
|
CaughtStackTrace = null;
|
||||||
|
|
||||||
|
Exception e;
|
||||||
|
try {
|
||||||
|
throw new Exception("test");
|
||||||
|
} catch (Exception e2) {
|
||||||
|
e = e2;
|
||||||
|
}
|
||||||
|
|
||||||
|
var edi = ExceptionDispatchInfo.Capture(e);
|
||||||
|
|
||||||
|
edi.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Handler (Exception e)
|
||||||
|
{
|
||||||
|
var split = e.StackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
Assert.AreEqual (5, split.Length, "#1");
|
||||||
|
Assert.IsTrue (split [1].Contains ("---"), "#2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ExceptionHandlingWithExceptionDispatchInfo ()
|
||||||
|
{
|
||||||
|
var method = new DynamicMethod ("", typeof(void), new[] { typeof(int) }, typeof (DynamicMethodTest));
|
||||||
|
var ig = method.GetILGenerator ();
|
||||||
|
|
||||||
|
ig.BeginExceptionBlock();
|
||||||
|
ig.Emit(OpCodes.Call, typeof(ExceptionHandlingWithExceptionDispatchInfo_Test_Support).GetMethod("ThrowMe"));
|
||||||
|
|
||||||
|
ig.BeginCatchBlock(typeof(Exception));
|
||||||
|
ig.Emit(OpCodes.Call, typeof(ExceptionHandlingWithExceptionDispatchInfo_Test_Support).GetMethod("Handler"));
|
||||||
|
ig.EndExceptionBlock();
|
||||||
|
|
||||||
|
ig.Emit(OpCodes.Ret);
|
||||||
|
|
||||||
|
var invoke = (Action<int>) method.CreateDelegate (typeof(Action<int>));
|
||||||
|
invoke (444);
|
||||||
|
}
|
||||||
|
|
||||||
#if !MONODROID
|
#if !MONODROID
|
||||||
// RUNTIME: crash
|
// RUNTIME: crash
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -165,7 +165,7 @@ namespace MonoTests.System.Runtime.ExceptionServices
|
|||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
var st = new StackTrace (ex, true);
|
var st = new StackTrace (ex, true);
|
||||||
var split = ex.StackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
var split = st.ToString ().Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
Assert.AreEqual (4, split.Length, "#1");
|
Assert.AreEqual (4, split.Length, "#1");
|
||||||
Assert.IsTrue (split [1].Contains ("---"), "#2");
|
Assert.IsTrue (split [1].Contains ("---"), "#2");
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
8989927fb604b8ca8467922e3dd5c67c74761f5c
|
80ad68773619189fd92720dfc4be4dc88e96837d
|
@ -1 +1 @@
|
|||||||
a55ad8f540597ae0a40e9962f76193e6c788be48
|
c1b008b9b65aea06d591cf25fb0b8e290e1e8103
|
@ -1 +1 @@
|
|||||||
b8cea6dcffe27a5b0a143aebedac463756863910
|
efb429e450136e909b0edfdffcf39c51066a5d82
|
@ -1 +1 @@
|
|||||||
2a1000922df13cc892dd88a838f0cc92bba9af6d
|
23172d2e452014cf90875324e9178ca360a9b996
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user