Class StackTracer
Utility class for collecting stack traces - useful when you want to make debugging easier by collecting run-time data on where your classes get called from. Enabled by EnableScaffolding AND EnableStackTracing, which default to FALSE (EnableStackTracing defaults to TRUE in DEBUG builds).
Namespace: SuperOffice.Util
Assembly: SoCore.dll
Syntax
public class StackTracer : Object
Remarks
StackTracer has been implemented in the TableInfo base class, because it can be infuriatingly hard to discover who allocated a certain ContactTableInfo or whatever when you start getting unwanted cross joins. This example is taken from the TableInfo class:
Properties
StackTrace
Utility class for collecting stack traces - useful when you want to make debugging easier by collecting run-time data on where your classes get called from. Enabled by EnableScaffolding AND EnableStackTracing, which default to FALSE (EnableStackTracing defaults to TRUE in DEBUG builds).
Declaration
public string[] StackTrace { get; }
Property Value
Type | Description |
---|---|
String[] |
Remarks
StackTracer has been implemented in the TableInfo base class, because it can be infuriatingly hard to discover who allocated a certain ContactTableInfo or whatever when you start getting unwanted cross joins. This example is taken from the TableInfo class:
Methods
FormatTrace(StackTracer)
Return a formatted trace or the empty string
Declaration
public static string FormatTrace(StackTracer trace)
Parameters
Type | Name | Description |
---|---|---|
StackTracer | trace | StackTracer object to format, or null |
Returns
Type | Description |
---|---|
String | Formatted trace or empty string |
Remarks
StackTracer has been implemented in the TableInfo base class, because it can be infuriatingly hard to discover who allocated a certain ContactTableInfo or whatever when you start getting unwanted cross joins. This example is taken from the TableInfo class:
GetStack()
Get one level from the stack directly above the caller's level
Declaration
public static StackTracer GetStack()
Returns
Type | Description |
---|---|
StackTracer | StackTracer object containing the trace, or null if tracing is off |
Remarks
StackTracer has been implemented in the TableInfo base class, because it can be infuriatingly hard to discover who allocated a certain ContactTableInfo or whatever when you start getting unwanted cross joins. This example is taken from the TableInfo class:
GetStack(Int32)
Get one level from the stack, skipping a number of additional levels first
Declaration
public static StackTracer GetStack(int levelsToSkip)
Parameters
Type | Name | Description |
---|---|---|
Int32 | levelsToSkip | Number of levels to skip, 1 means your parent etc |
Returns
Type | Description |
---|---|
StackTracer | StackTracer object containing the trace, or null if tracing is off |
Remarks
StackTracer has been implemented in the TableInfo base class, because it can be infuriatingly hard to discover who allocated a certain ContactTableInfo or whatever when you start getting unwanted cross joins. This example is taken from the TableInfo class:
GetStack(Int32, Int32)
Get the given number of levels from the stack, skipping a number of additional levels first
Declaration
public static StackTracer GetStack(int levelsToSkip, int levelsToKeep)
Parameters
Type | Name | Description |
---|---|---|
Int32 | levelsToSkip | Number of levels to skip, 1 means your parent etc |
Int32 | levelsToKeep | Number of levels to keep, will be limited to available. Specify -1 to get all. |
Returns
Type | Description |
---|---|
StackTracer | StackTracer object containing the trace, or null if tracing is off |
Remarks
StackTracer has been implemented in the TableInfo base class, because it can be infuriatingly hard to discover who allocated a certain ContactTableInfo or whatever when you start getting unwanted cross joins. This example is taken from the TableInfo class:
GetThreadDomainId()
Return a string with the AppDomain and Thread id's in a form suitable for debugging/console logging
Declaration
public static string GetThreadDomainId()
Returns
Type | Description |
---|---|
String |
Remarks
StackTracer has been implemented in the TableInfo base class, because it can be infuriatingly hard to discover who allocated a certain ContactTableInfo or whatever when you start getting unwanted cross joins. This example is taken from the TableInfo class:
GetToLastSuperOffice()
Obtain a stack trace, from the current frame and back to the most-remote SuperOffice-assembly frame; plus one to show where we came from
Declaration
public static string GetToLastSuperOffice()
Returns
Type | Description |
---|---|
String |
Remarks
StackTracer has been implemented in the TableInfo base class, because it can be infuriatingly hard to discover who allocated a certain ContactTableInfo or whatever when you start getting unwanted cross joins. This example is taken from the TableInfo class:
ToString()
Return the current stack levels as a single string, with newlines between levels
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
Remarks
StackTracer has been implemented in the TableInfo base class, because it can be infuriatingly hard to discover who allocated a certain ContactTableInfo or whatever when you start getting unwanted cross joins. This example is taken from the TableInfo class: