[mapguide-commits] r7972 - trunk/MgDev/Web/src/DotNetApi/Foundation
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Feb 8 08:57:01 PST 2014
Author: jng
Date: 2014-02-08 08:57:01 -0800 (Sat, 08 Feb 2014)
New Revision: 7972
Modified:
trunk/MgDev/Web/src/DotNetApi/Foundation/ManagedException.cs
Log:
#2365: Add .net portion of the stack trace for MgException proxy classes in .net and modify ToString() output to include both .net and C++ parts.
Modified: trunk/MgDev/Web/src/DotNetApi/Foundation/ManagedException.cs
===================================================================
--- trunk/MgDev/Web/src/DotNetApi/Foundation/ManagedException.cs 2013-12-26 07:41:40 UTC (rev 7971)
+++ trunk/MgDev/Web/src/DotNetApi/Foundation/ManagedException.cs 2014-02-08 16:57:01 UTC (rev 7972)
@@ -68,9 +68,34 @@
{
get
{
- return mIsWrapper ? ((MgException)this).GetStackTrace() : mStackTrace;
+ if (mIsWrapper)
+ {
+ //Some cosmetic cleaning of the C++ stack trace to better line up with the .net one
+ string[] mgStackTrace = ((MgException)this).GetStackTrace().Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
+ //This currently looks like the following if we re-join:
+ //
+ // at- <stack frame>
+ // at- <stack frame>
+ // at- <stack frame>
+ //
+ //The "-" being a leftover, so replace "at-" with "at" as well after re-joining.
+ //The reason we don't blindly replace "-" in the C++ stack is because we don't want to scramble any physical path
+ //that would also contain a "-"
+ string sanitizedStack = (" at" + string.Join(Environment.NewLine + " at", mgStackTrace)).Replace("at-", "at");
+ return string.Format("{0}{1} ==== [C++ <-> .net] ===={1}{2}", sanitizedStack, Environment.NewLine, base.StackTrace);
+ }
+ else
+ {
+ return mStackTrace;
+ }
}
}
+
+ public override string ToString()
+ {
+ string className = this.GetType().ToString();
+ return string.Format("{0}: {1}{2}{3}", className, this.Message, Environment.NewLine, this.StackTrace);
+ }
public virtual void Dispose()
{
More information about the mapguide-commits
mailing list