Hi,
As I can see, Compact Framework has no System.Environment.StackTrace.
Is there any other way to find out stack trace when I catch exception?
Thanx in advance,
Cheya

Re: StackTrace by Chris

Chris
Mon Oct 04 13:01:43 CDT 2004

No.

-Chris


"Nenad Dobrilovic" <cheya1975@hotmail.com> wrote in message
news:OyiqhTiqEHA.2856@TK2MSFTNGP10.phx.gbl...
> Hi,
> As I can see, Compact Framework has no System.Environment.StackTrace.
> Is there any other way to find out stack trace when I catch exception?
> Thanx in advance,
> Cheya



Re: StackTrace by Darren

Darren
Mon Oct 04 15:12:09 CDT 2004

Cheya,

There is no assembly to do this for you, but if you take the time to
iterate through the exception object's error parameters and log/display the
values, you can often get more information than even a stack trace
would give you. Below is an example from the .Net CF Core Reference
provided for a SqlCE exception. I have created similar methods for Web
exceptions, I/O exceptions, etc. If you ever run a debug session and start
drilling down through the nexted levels of exception parameters, there is
a host of valuable information in this heirarchy that you can use to
troubleshoot
your application.

private void _displaySQLCEErrors(SqlCeException ex)
{
SqlCeErrorCollection errorCollection = ex.Errors;

StringBuilder bld = new StringBuilder();
Exception inner = ex.InnerException;

foreach (SqlCeError err in errorCollection)
{
bld.Append("\n Error Code: " + err.HResult.ToString("X"));
bld.Append("\n Message : " + err.Message);
bld.Append("\n Minor Err.: " + err.NativeError);
bld.Append("\n Source : " + err.Source);

foreach (int numPar in err.NumericErrorParameters)
{
if ( 0 != numPar ) bld.Append( "\n Num. Par. : " + numPar );
}

foreach ( string errPar in err.ErrorParameters )
{
if ( String.Empty != errPar ) bld.Append( "\n Err. Par. : " + errPar );
}

MessageBox.Show( bld.ToString(), "SQL Server CE Error" );
bld.Remove(0, bld.Length);
}
}

-Darren


"Nenad Dobrilovic" <cheya1975@hotmail.com> wrote in message
news:OyiqhTiqEHA.2856@TK2MSFTNGP10.phx.gbl...
> Hi,
> As I can see, Compact Framework has no System.Environment.StackTrace.
> Is there any other way to find out stack trace when I catch exception?
> Thanx in advance,
> Cheya



Re: StackTrace by Alex

Alex
Mon Oct 04 22:21:36 CDT 2004

Darren Shaffer wrote:
> MessageBox.Show( bld.ToString(), "SQL Server CE Error" );
> bld.Remove(0, bld.Length);

I have to admit I'm a bit curious as of the purpose of the last line

Re: StackTrace by Darren

Darren
Mon Oct 04 23:05:03 CDT 2004

Alex,

This method came out of The Core Reference samples - it's been sitting in my
personal DatabaseManager class for 2 years now and I never really looked
all that closely at it since it never makes it into production builds (debug
only).

I think the intention was to save StringBuilder creation by instantiating a
single
StringBuilder and reusing by clearing it's contents each time a new
error parameter is dumped as the loop executes.

-Darren


"Alex Feinman (MVP)" <public_news@alexfeinman.com> wrote in message
news:e6S3tpoqEHA.868@TK2MSFTNGP10.phx.gbl...
> Darren Shaffer wrote:
>> MessageBox.Show( bld.ToString(), "SQL Server CE Error" );
>> bld.Remove(0, bld.Length);
>
> I have to admit I'm a bit curious as of the purpose of the last line



Re: StackTrace by Darren

Darren
Mon Oct 04 23:07:39 CDT 2004

I see your point - bld is not even in the loop.....

-Darren

"Alex Feinman (MVP)" <public_news@alexfeinman.com> wrote in message
news:e6S3tpoqEHA.868@TK2MSFTNGP10.phx.gbl...
> Darren Shaffer wrote:
>> MessageBox.Show( bld.ToString(), "SQL Server CE Error" );
>> bld.Remove(0, bld.Length);
>
> I have to admit I'm a bit curious as of the purpose of the last line



RE: StackTrace by pavelt

pavelt
Wed Oct 13 19:27:09 CDT 2004

If you can afford (in your debugging) not to catch/trap the exception - you
will get Exception Dialog Box which will contain the call stack at the
momemt of exception.

Pavel Treskunov
.NET Compact Framework
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
> Date: Mon, 04 Oct 2004 17:16:43 +0200
> From: Nenad Dobrilovic <cheya1975@hotmail.com>
> User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616)
> X-Accept-Language: en-us, en
> MIME-Version: 1.0
> Subject: StackTrace
> Content-Type: text/plain; charset=us-ascii; format=flowed
> Content-Transfer-Encoding: 7bit
> Message-ID: <OyiqhTiqEHA.2856@TK2MSFTNGP10.phx.gbl>
> Newsgroups: microsoft.public.dotnet.framework.compactframework
> NNTP-Posting-Host: 217.24.18.195
> Lines: 1
> Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
> Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:62493
> X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
>
> Hi,
> As I can see, Compact Framework has no System.Environment.StackTrace.
> Is there any other way to find out stack trace when I catch exception?
> Thanx in advance,
> Cheya
>