Hi All,
I'm basically just trying to get started with the Exception Management
Application Block and am having some technical difficulties. All I
want to do to begin with is create a simple Windows Application (which
I have done and named "ExceptionManagementTester") and within it
create and use a custom publisher.
The Exception Management Tester Solution contains ONE project with
these files:
Reference
App.Config
AssemblyInfo.vb
ExceptionPublisher.vb
Form1.vb
InterfaceDefinitions.vb
The contents of App.Config is shown below:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="exceptionManagement"
type="Microsoft.ApplicationBlocks.ExceptionManagem ent.ExceptionManagerSectionHandler,Microsoft.Appli cationBlocks.ExceptionManagement"
/>
</configSections>
<exceptionManagement mode="on">
<publisher assembly="ExceptionManagementTester"
type="ExceptionManagementTester.ExceptionPublisher "
fileName="c:\QuickStartSamplesExceptionLog.txt" />
</exceptionManagement>
</configuration>
References are both made to ExceptionManagement and
ExceptionManagement.Interfaces. The form has a button on it with code
behind it that just creates an exception.
The problem I have is that when execution reaches the
PublishToCustomPublisher Method with the signature shown below in the
ExceptionManager Class
Private Shared Sub PublishToCustomPublisher(ByVal exception As
Exception, ByVal additionalInfo As NameValueCollection, ByVal
publisher As PublisherSettings)
it gives me "specified cast is not valid". Here is the exact line of
code it "blows up"
m_Publisher = CType(Activate(publisher.AssemblyName,
publisher.TypeName), IExceptionPublisher) . . . just after calling the
activate function
Apparently, it's blowing up in trying to convert from type "Object" to
type "IExceptionPublisher" and I don't understand why exactly.
Because I have very little experience with the Exception Management
Application Block I suspect it's something simple. I'm half wondering
if I can't do this all in ONE project for some reason.
At any rate, if anyone could shed some light on this for me it would
be greatly appreciated.
Thanks,
Andy