Implementing custom exceptions in a Portable Class Library

后端 未结 1 1653
一整个雨季
一整个雨季 2021-02-12 20:48

When designing custom exceptions for .NET, MSDN provides these guidelines. In particular, the guidelines state that a custom exception:

  • should be serializable, i.e
1条回答
  •  孤独总比滥情好
    2021-02-12 21:31

    Basically, ignore that guidance - that is for full .NET, and does not apply to portable class library projects. Indeed, if we look at (say) Silverlight (which includes WP7) we see:

    [ClassInterfaceAttribute(ClassInterfaceType.None)]
    [ComVisibleAttribute(true)]
    public class Exception
    

    Frankly, the main consumer of that requirement was remoting... and that is not in huge demand now.

    0 讨论(0)
提交回复
热议问题