Codessentials

  • Increase font size
  • Default font size
  • Decrease font size
Home Coding tips .Net tips Creating a Stacktrace manually

Creating a Stacktrace manually

E-mail Print PDF
Sometimes it is required to log the location and the stacktrace even if no exception occured.
Here is a function that returns a stacktrace on demand.
Per default you can use aStepsToSkip = 1 as you are not interested in the fact that the stacktrace started at buildStackTrace but you want the location where this function was called.

Public Shared Function buildStackTrace(Optional ByVal aStepsToSkip As Integer = 1) As String
   Dim stacktrace As New StackTrace(aStepsToSkip, True)
   Return stacktrace.ToString
End Function
Last Updated on Thursday, 22 October 2009 06:54  

Bookmark

AddThis Social Bookmark Button

Advertisement


Newsflash

Jack Wallen is the host of the TechRepublic open source blog as well as a regular writer in the "10 Things..." and the "How Do I..." blogs.

In this article Jack Wallen reviews Yadis! Backup.

Some highlights:

There are tons of backup solutions available, ranging from simple, single-user applications to much larger, complex solutions. Most all of these solutions will do what the creators claim — back up your data. You always hope that data is backed up safely and that it will be there in that unforeseen moment when you need it. There is one backup solution amid the myriad of others that offers a unique little twist on the old tried-and-true process. Yadis! Backup.
...

Yadis! Backup is one of the more foolproof backup solutions I’ve come across. If you are looking for a simple backup solution that does not require any scheduling, this might be what you are seeking. It’s not exactly Enterprise-ready, but for smaller backups it’s a pretty sweet solution.

Read the full article here.