Problem With Exception Management Application Block

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy

    #1

    Problem With Exception Management Application Block

    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 "ExceptionManag ementTester") 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
    ExceptionPublis her.vb
    Form1.vb
    InterfaceDefini tions.vb

    The contents of App.Config is shown below:

    <?xml version="1.0" encoding="utf-8" ?>

    <configuratio n>

    <configSections >
    <section name="exception Management"
    type="Microsoft .ApplicationBlo cks.ExceptionMa nagement.Except ionManagerSecti onHandler,Micro soft.Applicatio nBlocks.Excepti onManagement"
    />
    </configSections>

    <exceptionManag ement mode="on">
    <publisher assembly="Excep tionManagementT ester"
    type="Exception ManagementTeste r.ExceptionPubl isher"
    fileName="c:\Qu ickStartSamples ExceptionLog.tx t" />
    </exceptionManage ment>

    </configuration>

    References are both made to ExceptionManage ment and
    ExceptionManage ment.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
    PublishToCustom Publisher Method with the signature shown below in the
    ExceptionManage r Class

    Private Shared Sub PublishToCustom Publisher(ByVal exception As
    Exception, ByVal additionalInfo As NameValueCollec tion, ByVal
    publisher As PublisherSettin gs)

    it gives me "specified cast is not valid". Here is the exact line of
    code it "blows up"

    m_Publisher = CType(Activate( publisher.Assem blyName,
    publisher.TypeN ame), IExceptionPubli sher) . . . just after calling the
    activate function

    Apparently, it's blowing up in trying to convert from type "Object" to
    type "IExceptionPubl isher" 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
  • Cor Ligthert

    #2
    Re: Problem With Exception Management Application Block

    Andy,

    The most simple thing to find this problems is to pull them appart in
    different rows using intermidiate values or objects for that.

    I hope this helps?

    Cor

    "Andy" <apt35lo@aol.co m>
    ..[color=blue]
    > 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 "ExceptionManag ementTester") 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
    > ExceptionPublis her.vb
    > Form1.vb
    > InterfaceDefini tions.vb
    >
    > The contents of App.Config is shown below:
    >
    > <?xml version="1.0" encoding="utf-8" ?>
    >
    > <configuratio n>
    >
    > <configSections >
    > <section name="exception Management"
    > type="Microsoft .ApplicationBlo cks.ExceptionMa nagement.Except ionManagerSecti onHandler,Micro soft.Applicatio nBlocks.Excepti onManagement"
    > />
    > </configSections>
    >
    > <exceptionManag ement mode="on">
    > <publisher assembly="Excep tionManagementT ester"
    > type="Exception ManagementTeste r.ExceptionPubl isher"
    > fileName="c:\Qu ickStartSamples ExceptionLog.tx t" />
    > </exceptionManage ment>
    >
    > </configuration>
    >
    > References are both made to ExceptionManage ment and
    > ExceptionManage ment.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
    > PublishToCustom Publisher Method with the signature shown below in the
    > ExceptionManage r Class
    >
    > Private Shared Sub PublishToCustom Publisher(ByVal exception As
    > Exception, ByVal additionalInfo As NameValueCollec tion, ByVal
    > publisher As PublisherSettin gs)
    >
    > it gives me "specified cast is not valid". Here is the exact line of
    > code it "blows up"
    >
    > m_Publisher = CType(Activate( publisher.Assem blyName,
    > publisher.TypeN ame), IExceptionPubli sher) . . . just after calling the
    > activate function
    >
    > Apparently, it's blowing up in trying to convert from type "Object" to
    > type "IExceptionPubl isher" 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[/color]


    Comment

    Working...