小编wea*_*rim的帖子

为什么我在调用ExceptionPolicy.HandleException时遇到System.InvalidOperationException?

我正在开发一个测试程序,帮助我弄清楚如何使用Microsoft.Practices.EnterpriseLibrary.ExceptionHandling框架.该程序定义了几种自定义异常类型,并将自定义异常处理程序与每种类型相关 在运行时,程序会提示用户输入异常类型,抛出异常,并使用ExceptionHandling框架为异常类型调用适当的异常处理程序:

using System;
using System.Collections.Specialized;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration;

namespace ConsoleApplication1
{
    public class AException  : Exception  { public AException(string message)  : base(message) { } }
    public class BException  : Exception  { public BException(string message)  : base(message) { } }
    public class BBException : BException { public BBException(string message) : base(message) { } }

    public class WrapperException : Exception
    {
        public WrapperException(Exception innerException)
            : base("Wrapped exception: [" + innerException.Message + "]", innerException) { }
    }

    public class …
Run Code Online (Sandbox Code Playgroud)

c# enterprise-library exception-handling exception

3
推荐指数
1
解决办法
6550
查看次数