Throwing exceptions from a custom configuration section handler

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

    #1

    Throwing exceptions from a custom configuration section handler

    Hi there - I have created my own implementation of
    System.Configur ation.IConfigur ationSectionHan dler in order to have a special
    configuration section in an App.Config file that configures my framework.

    When a user makes an invalid configuration in this section I throw a
    meaningful exception, explaining what went wrong.

    Now I would expect this message to be part of the stacktraces printed from
    the application, but apparently it eats my exception and simply states that
    something went wrong during the reading of my configuration section.

    Does anyone know how to make .NET print all the stack traces?

    Regards
    Thomas Koch


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Throwing exceptions from a custom configuration section handler

    Thomas,

    Unfortunately, there is no hook into that kind of functionality. I
    think that the class is trying to be smart.

    However, did you check the InnerException property on the exception? It
    is possible that your exeption would be in there somewhere, and that the
    exception thrown is what is thrown when any exception occurs.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Thomas Koch" <thomask_ts@yah oo.dk> wrote in message
    news:Oceg5bgmDH A.2244@TK2MSFTN GP12.phx.gbl...[color=blue]
    > Hi there - I have created my own implementation of
    > System.Configur ation.IConfigur ationSectionHan dler in order to have a[/color]
    special[color=blue]
    > configuration section in an App.Config file that configures my framework.
    >
    > When a user makes an invalid configuration in this section I throw a
    > meaningful exception, explaining what went wrong.
    >
    > Now I would expect this message to be part of the stacktraces printed from
    > the application, but apparently it eats my exception and simply states[/color]
    that[color=blue]
    > something went wrong during the reading of my configuration section.
    >
    > Does anyone know how to make .NET print all the stack traces?
    >
    > Regards
    > Thomas Koch
    >
    >[/color]


    Comment

    Working...