Hi Jorge,
Thanks for responding to my email . . . I thought I was implementing the
IExceptionPublisher Interface. Here's the code for
ExceptionPublisher.vb
****************************************************
Imports System.Collections.Specialized
Imports System.Xml
Imports System.IO
Imports System.Text
Public Class ExceptionPublisher
Implements IExceptionPublisher
Private m_LogName As String = "C:\ErrorLog.txt"
Private m_OpMail As String = ""
' Provide implementation of the IPublishException interface
' This contains the single Publish method.
Sub Publish(ByVal e As Exception, ByVal AdditionalInfo As
NameValueCollection, ByVal ConfigSettings As NameValueCollection)
Implements IExceptionPublisher.Publish
' Load Config values if they are provided.
If Not ConfigSettings Is Nothing Then
If Not ConfigSettings("fileName") Is Nothing AndAlso
ConfigSettings("fileName").Length > 0 Then
m_LogName = ConfigSettings("fileName")
End If
If Not ConfigSettings("operatorMail") Is Nothing AndAlso
ConfigSettings("operatorMail").Length > 0 Then
m_OpMail = ConfigSettings("operatorMail")
End If
' Create StringBuilder to maintain publishing information.
Dim strInfo As StringBuilder = New StringBuilder
'Record the contents of the AdditionalInfo collection.
If Not AdditionalInfo Is Nothing Then
' Record General information.
strInfo.AppendFormat("{0}General Information{0}",
Environment.NewLine)
strInfo.AppendFormat("{0}Additonal Info:",
Environment.NewLine)
Dim i As String
For Each i In AdditionalInfo
strInfo.AppendFormat("{0}{1}: {2}",
Environment.NewLine, i, AdditionalInfo.Get(i))
Next
' Append the exception text
strInfo.AppendFormat("{0}{0}Exception
Information{0}{1}", Environment.NewLine, e.ToString())
' Write the entry to the log file.
Dim fs As FileStream = File.Open(m_LogName,
FileMode.Create, FileAccess.ReadWrite)
Dim sw As New StreamWriter(fs)
sw.Write(strInfo.ToString())
sw.Close()
fs.Close()
' send notification email if operatorMail attribute was
provided
'If m_OpMail.Length > 0 Then
' Dim subject As String = "Exception Notification"
' Dim body As String = strInfo.ToString()
' SmtpMail.Send("CustomPublisher@mycompany.com",
m_OpMail, subject, body)
'End If
End If
End If
End Sub
End Class
********************************
Your feedback is appreciated . . . Thanks Andy!!!
Jorge Matos - 21 Oct 2004 14:11 GMT
Andy,
You can put all the projects in the same solution - including the EMAB as
well since the source is available. I suspect that the ExceptionPublisher
might be loading the wrong dll or an incorrect version of your custom
publisher.
I would use the debugger and see exactly what assembly and type the
"Activate()" function is trying to instantiate. Make sure your solution
includes the following projects:
Microsoft.ApplicationBlocks.ExceptionManagement
Microsoft.ApplicationBlocks.ExceptionManagement.Interfaces
YourWindowsProject
HTH
Jorge
> Hi Jorge,
>
[quoted text clipped - 81 lines]
>
> Your feedback is appreciated . . . Thanks Andy!!!
Andy - 22 Oct 2004 02:37 GMT
Hey Jorge,
Thanks again for your feedback . . .
I was actually trying to "cut some corners" with what I was doing so I
scrapped that approach, created another solution, followed your advice
and now everything is working as it should.
Once again I appreciate your help . . .
Thanks so much,
Andy