Click here to Skip to main content
15,892,537 members
Articles / Web Development / HTML

Catch All Bugs with BugTrap!

Rate me:
Please Sign up or sign in to vote.
4.34/5 (84 votes)
31 Jan 2009MIT5 min read 1.9M   9.1K   293  
A tool that can catch unhandled errors and exceptions, and deliver error reports to remote support servers
/*
 * This is a part of the BugTrap package.
 * Copyright (c) 2005-2007 IntelleSoft.
 * All rights reserved.
 *
 * Description: .NET symbolic engine.
 * Author: Maksim Pyatkovskiy.
 *
 * This source code is only intended as a supplement to the
 * BugTrap package reference and related electronic documentation
 * provided with the product. See these sources for detailed
 * information regarding the BugTrap package.
 */

#pragma once

#ifdef _MANAGED

#include "BugTrapNet.h"

#pragma managed

using namespace System;
using namespace System::Threading;
using namespace System::Diagnostics;
using namespace System::Text;
using namespace System::Collections;
using namespace System::Reflection;

namespace IntelleSoft
{
	namespace BugTrap
	{
		private ref class StackFrameEnumerator
		{
		public:
			StackFrameEnumerator(Thread^ thread);
			StackFrameEnumerator(Exception^ exception);
			void InitStackTrace(void);
			StackFrame^ GetFirstStackTraceEntry(void);
			StackFrame^ GetNextStackTraceEntry(void);

		private:
			initonly StackTrace^ stackTrace;
			int frameIndex;
		};

		inline StackFrameEnumerator::StackFrameEnumerator(Thread^ thread)
		{
			this->stackTrace = gcnew StackTrace(thread, true);
			this->frameIndex = int::MaxValue;
		}

		inline StackFrameEnumerator::StackFrameEnumerator(Exception^ exception)
		{
			this->stackTrace = gcnew StackTrace(exception, true);
			this->frameIndex = int::MaxValue;
		}

		inline void StackFrameEnumerator::InitStackTrace(void)
		{
			this->frameIndex = 0;
		}

		inline StackFrame^ StackFrameEnumerator::GetFirstStackTraceEntry(void)
		{
			this->InitStackTrace();
			return this->GetNextStackTraceEntry();
		}

		private ref class AssemblyEnumerator
		{
		public:
			AssemblyEnumerator(void);
			void InitAssemblies(void);
			Assembly^ GetFirstAssembly(void);
			Assembly^ GetNextAssembly(void);

		private:
			initonly array<Assembly^>^ assemblies;
			IEnumerator^ assemblyEnumerator;
		};

		inline void AssemblyEnumerator::InitAssemblies(void)
		{
			this->assemblyEnumerator->Reset();
		}

		inline Assembly^ AssemblyEnumerator::GetFirstAssembly(void)
		{
			this->InitAssemblies();
			return this->GetNextAssembly();
		}
	}
}

#pragma unmanaged

#endif // _MANAGED

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions