views:

84

answers:

1

On a thread that is processing new data in the system, if the data is invalid I write a message in the event log, containing the Environment.StackTrace information.

Writing in the event log throws an exception with no text message

Message: 
CallStack -    at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
       at System.Environment.get_StackTrace()
       at <my method that writes in the event log>

Any ideas why this happens?

EDIT: I am interested in what can cause the Environment.StackTrace to throw exception in general, so that i can understand what is happening in my case

A: 

You need to capture the stacktrace before moving onto a separate thread.

Stacktrace will only show you the frames up to the root of the thread.

leppie
Yes, I will only see the frames of the thread, but why does it throw exception?
anchandra