2010-06-21 Atsushi Enomoto <atsushi@ximian.com>
[mcs.git] / class / System.ComponentModel.Composition / src / ComponentModel / System / ComponentModel / Composition / CompositionContractMismatchException.cs
blobf1a5f4968b88c29ca5a7e20871a46227bce57cbf
1 // -----------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 // -----------------------------------------------------------------------
4 using System;
5 using System.Runtime.Serialization;
7 namespace System.ComponentModel.Composition
9 /// <summary>
10 /// The exception that is thrown when the underlying exported value or metadata of an
11 /// <see cref="Lazy{T}"/> or <see cref="Lazy{T, TMetadataView}"/> object cannot be
12 /// cast to <c>T</c> or <c>TMetadataView</c>, respectively.
13 /// </summary>
14 [Serializable]
15 public class CompositionContractMismatchException : Exception
17 /// <summary>
18 /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class.
19 /// </summary>
20 public CompositionContractMismatchException()
21 : this((string)null, (Exception)null)
25 /// <summary>
26 /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class
27 /// with the specified error message.
28 /// </summary>
29 /// <param name="message">
30 /// A <see cref="String"/> containing a message that describes the
31 /// <see cref="CompositionContractMismatchException"/>; or <see langword="null"/> to set
32 /// the <see cref="Exception.Message"/> property to its default value.
33 /// </param>
34 public CompositionContractMismatchException(string message)
35 : this(message, (Exception)null)
39 /// <summary>
40 /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class
41 /// with the specified error message and exception that is the cause of the
42 /// exception.
43 /// </summary>
44 /// <param name="message">
45 /// A <see cref="String"/> containing a message that describes the
46 /// <see cref="CompositionContractMismatchException"/>; or <see langword="null"/> to set
47 /// the <see cref="Exception.Message"/> property to its default value.
48 /// </param>
49 /// <param name="innerException">
50 /// The <see cref="Exception"/> that is the underlying cause of the
51 /// <see cref="CompositionContractMismatchException"/>; or <see langword="null"/> to set
52 /// the <see cref="Exception.InnerException"/> property to <see langword="null"/>.
53 /// </param>
54 public CompositionContractMismatchException(string message, Exception innerException)
55 : base(message, innerException)
59 #if !SILVERLIGHT
61 /// <summary>
62 /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class
63 /// with the specified serialization data.
64 /// </summary>
65 /// <param name="info">
66 /// The <see cref="SerializationInfo"/> that holds the serialized object data about the
67 /// <see cref="CompositionContractMismatchException"/>.
68 /// </param>
69 /// <param name="context">
70 /// The <see cref="StreamingContext"/> that contains contextual information about the
71 /// source or destination.
72 /// </param>
73 /// <exception cref="ArgumentNullException">
74 /// <paramref name="info"/> is <see langword="null"/>.
75 /// </exception>
76 /// <exception cref="SerializationException">
77 /// <paramref name="info"/> is missing a required value.
78 /// </exception>
79 /// <exception cref="InvalidCastException">
80 /// <paramref name="info"/> contains a value that cannot be cast to the correct type.
81 /// </exception>
82 [System.Security.SecuritySafeCritical]
83 protected CompositionContractMismatchException(SerializationInfo info, StreamingContext context)
84 : base(info, context)
88 #endif