Fix exception stacktrace when ulimit is hit OSX. (dotnet/coreclr#5802)
authorMike McLaughlin <mikem@microsoft.com>
Wed, 15 Jun 2016 22:03:57 +0000 (15:03 -0700)
committerGitHub <noreply@github.com>
Wed, 15 Jun 2016 22:03:57 +0000 (15:03 -0700)
* Fix exception stacktrace when ulimit is hit OSX.

Issue dotnet/coreclr#5782.

Wrap the everything in try/catch replacing the existing try/finally
and removed the recursion protection thread var.

* Restore recursion protection.

Commit migrated from https://github.com/dotnet/coreclr/commit/93a9d70bfa87193d29b69b3242f5cc588f417f0d

src/coreclr/src/mscorlib/src/System/Diagnostics/Stacktrace.cs

index 97a8c49..5c56efb 100644 (file)
@@ -121,7 +121,10 @@ namespace System.Diagnostics {
             {
                 if (s_symbolsMethodInfo == null)
                 {
-                    s_symbolsType = Type.GetType("System.Diagnostics.StackTraceSymbols, System.Diagnostics.StackTrace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", throwOnError: false);
+                    s_symbolsType = Type.GetType(
+                        "System.Diagnostics.StackTraceSymbols, System.Diagnostics.StackTrace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
+                        throwOnError: false);
+
                     if (s_symbolsType == null)
                         return;
 
@@ -145,12 +148,15 @@ namespace System.Diagnostics {
                     // ENC or the source/line info was already retrieved, the method token is 0.
                     if (rgiMethodToken[index] != 0)
                     {
-                        getSourceLineInfo(rgAssemblyPath[index], rgLoadedPeAddress[index], rgiLoadedPeSize[index], 
-                            rgInMemoryPdbAddress[index], rgiInMemoryPdbSize[index], rgiMethodToken[index], 
+                        getSourceLineInfo(rgAssemblyPath[index], rgLoadedPeAddress[index], rgiLoadedPeSize[index],
+                            rgInMemoryPdbAddress[index], rgiInMemoryPdbSize[index], rgiMethodToken[index],
                             rgiILOffset[index], out rgFilename[index], out rgiLineNumber[index], out rgiColumnNumber[index]);
                     }
                 }
             }
+            catch
+            {
+            }
             finally
             {
                 t_reentrancy--;