Subject: Thread was being aborted
Posted By: sohailmaroof Post Date: 1/9/2007 6:32:43 AM
Hi,

I am trying to Log the exceptions using Logging block in Flat File. For this purpose I have defined configuration in web.config file and below is the code.

I have created a utility function to log exceptions. But I am getting “Thread was being aborted.” Error. Below is the CallsStack:

Extended Properties:
    Callstack=   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at System.Diagnostics.TraceEventCache.get_Callstack()
   at System.Diagnostics.TraceListener.WriteFooter(TraceEventCache eventCache)
   at System.Diagnostics.TraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data)
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedTextWriterTraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data)
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data)
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogSource.TraceData(TraceEventType eventType, Int32 id, LogEntry logEntry, TraceListenerFilter traceListenerFilter)
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.ProcessLog(LogEntry log)
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.Write(LogEntry log)
   at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(LogEntry log)
   at AppUtilityMethods.LogExceptionEntry(Exception ex) in D:\Personal\CargoXpert\WebUI\App_Code\AppUtilityMethods.vb:line 12
   at _Default.Page_Load(Object sender, EventArgs e) in D:\Personal\CargoXpert\WebUI\Default.aspx.vb:line 36
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.default_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
   at System.Web.HttpApplication.ResumeSteps(Exception error)
   at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
   at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
   at System.Web.HttpRuntime.ProcessRequestNow(HttpWorkerRequest wr)
   at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
   at System.Web.HttpRuntime.ProcessRequest(HttpWorkerRequest wr)
   at Microsoft.VisualStudio.WebHost.Request.Process()
   at Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn)

Below is the code.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

      If IsPostBack = True Then

         Try

        ‘ Some Code here
    
         Catch ex As Exception

            AppUtilityMethods.LogExceptionEntry(ex)
            lblError.Text = "<br />Written to Application Event Log"

         End Try

      End If

End Sub

Public Class AppUtilityMethods

   Public Shared Sub LogExceptionEntry(ByVal ex As Exception)

      Dim log As LogEntry = New LogEntry()

      log.EventId = 6001
      log.Message = ex.Message
      log.Severity = Diagnostics.TraceEventType.Error
      log.Priority = 5

      Logger.Write(log)

   End Sub

End Class


Reply By: dparsons Reply Date: 1/9/2007 8:34:28 AM
Normally this is caused by trying to call response.redirect inside the catch{} blcok although I do not see one here.

What the problem probably is is that you are writing data out to your label control, comment out that line and see what happens.

-------------------------
I will only tell you how to do it, not do it for you.  
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
Reply By: abeen Reply Date: 1/13/2007 1:25:55 AM
“‘ Some Code here”#12288;is what ?

============================================  
  Success grows out of struggles to overcome difficulties.
Email:abeen8298@gmail.com
============================================  

Go to topic 54804

Return to index page 65
Return to index page 64
Return to index page 63
Return to index page 62
Return to index page 61
Return to index page 60
Return to index page 59
Return to index page 58
Return to index page 57
Return to index page 56