diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2016-03-22 21:06:18 +0100 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2016-03-22 21:06:18 +0100 |
commit | 399f417d1af2b2616448a6975638980da2c7d731 (patch) | |
tree | 69f2f993fac9a4e6812783076a95e450a9fa8d5d /src | |
parent | a6ae44dc12b4d58ff337090ed1318196e53066e5 (diff) | |
parent | 1b821412796486ee362b1672a19b705275441b15 (diff) | |
download | coreclr-399f417d1af2b2616448a6975638980da2c7d731.tar.gz coreclr-399f417d1af2b2616448a6975638980da2c7d731.tar.bz2 coreclr-399f417d1af2b2616448a6975638980da2c7d731.zip |
Merge pull request #3858 from janvorli/fix-exception-callstack
Fix exception to string in case of exception in callstack extraction
Diffstat (limited to 'src')
-rw-r--r-- | src/mscorlib/src/System/Diagnostics/Stacktrace.cs | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/src/mscorlib/src/System/Diagnostics/Stacktrace.cs b/src/mscorlib/src/System/Diagnostics/Stacktrace.cs index 897efc427b..85ec034eae 100644 --- a/src/mscorlib/src/System/Diagnostics/Stacktrace.cs +++ b/src/mscorlib/src/System/Diagnostics/Stacktrace.cs @@ -560,25 +560,41 @@ namespace System.Diagnostics { sb.Append(']'); } - // arguments printing - sb.Append('('); - ParameterInfo[] pi = mb.GetParameters(); - bool fFirstParam = true; - for (int j = 0; j < pi.Length; j++) + ParameterInfo[] pi = null; +#if FEATURE_CORECLR + try + { +#endif + pi = mb.GetParameters(); +#if FEATURE_CORECLR + } + catch + { + // The parameter info cannot be loaded, so we don't + // append the parameter list. + } +#endif + if (pi != null) { - if (fFirstParam == false) - sb.Append(", "); - else - fFirstParam = false; - - String typeName = "<UnknownType>"; - if (pi[j].ParameterType != null) - typeName = pi[j].ParameterType.Name; - sb.Append(typeName); - sb.Append(' '); - sb.Append(pi[j].Name); - } - sb.Append(')'); + // arguments printing + sb.Append('('); + bool fFirstParam = true; + for (int j = 0; j < pi.Length; j++) + { + if (fFirstParam == false) + sb.Append(", "); + else + fFirstParam = false; + + String typeName = "<UnknownType>"; + if (pi[j].ParameterType != null) + typeName = pi[j].ParameterType.Name; + sb.Append(typeName); + sb.Append(' '); + sb.Append(pi[j].Name); + } + sb.Append(')'); + } // source location printing if (displayFilenames && (sf.GetILOffset() != -1)) |