From 6ebf1b8adfecbe44b2706c219b1b2d93720935cc Mon Sep 17 00:00:00 2001 From: Woongsuk Cho Date: Thu, 15 Apr 2021 08:23:51 +0900 Subject: [PATCH 1/2] Modify TC to compare strings before ':' In order to avoid failure due to modification of #44013, the TC has been modified so that the content after':' is not compared. --- .../emptystacktrace/oomexception01.cs | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/src/tests/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs b/src/tests/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs index 0ac3e49f5abb6a..32942d796bea5b 100644 --- a/src/tests/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs +++ b/src/tests/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs @@ -18,44 +18,55 @@ public static int Main() public void RunTest() { - CreateAndThrow(); + CreateAndThrow(); } public void CreateAndThrow() { - string currStack; - + string currStack; + try { - throw new Exception(); + throw new Exception(); + } + catch(Exception e) + { + currStack = e.StackTrace; } - catch(Exception e) - { - currStack = e.StackTrace; - } - + try - { + { Guid[] g = new Guid[Int32.MaxValue]; } catch(OutOfMemoryException e) { retVal = 100; - - Console.WriteLine("Caught OOM"); - if(e.StackTrace.ToString().Substring(0, e.StackTrace.Length - 8) != currStack.Substring(0, currStack.Length - 8)) - { - Console.WriteLine("Actual Exception Stack Trace:"); + Console.WriteLine("Caught OOM"); + + string oomStack = e.StackTrace; + string expectedStack = currStack; + + if (oomStack.IndexOf(':') != -1) + { + oomStack = oomStack.Substring(0, oomStack.IndexOf(':') - 1); + } + + if (expectedStack.IndexOf(':') != -1) + { + expectedStack = expectedStack.Substring(0, expectedStack.IndexOf(':') - 1); + } + + if (oomStack != expectedStack) + { + Console.WriteLine("Actual Exception Stack Trace:"); Console.WriteLine(e.StackTrace); Console.WriteLine(); - Console.WriteLine("Expected Stack Trace:"); - Console.WriteLine(currStack.ToString()); + Console.WriteLine("Expected Stack Trace:"); + Console.WriteLine(currStack.ToString()); retVal = 50; } } - } - } From a98a53f072d99f2fefe1f06a8a7dcf8594be4678 Mon Sep 17 00:00:00 2001 From: Woongsuk Cho Date: Thu, 15 Apr 2021 10:13:23 +0900 Subject: [PATCH 2/2] Enable OOMException01 Failed TC is fixed at #51280 --- src/tests/issues.targets | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 0fd2318537f781..b575a39cc9caea 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -2,9 +2,6 @@ - - https://github.com/dotnet/runtime/issues/51209 - timeout