1 // -----------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 // -----------------------------------------------------------------------
5 using System
.Runtime
.Serialization
;
7 namespace System
.ComponentModel
.Composition
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.
15 public class CompositionContractMismatchException
: Exception
18 /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class.
20 public CompositionContractMismatchException()
21 : this((string)null, (Exception
)null)
26 /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class
27 /// with the specified error message.
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.
34 public CompositionContractMismatchException(string message
)
35 : this(message
, (Exception
)null)
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
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.
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"/>.
54 public CompositionContractMismatchException(string message
, Exception innerException
)
55 : base(message
, innerException
)
62 /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class
63 /// with the specified serialization data.
65 /// <param name="info">
66 /// The <see cref="SerializationInfo"/> that holds the serialized object data about the
67 /// <see cref="CompositionContractMismatchException"/>.
69 /// <param name="context">
70 /// The <see cref="StreamingContext"/> that contains contextual information about the
71 /// source or destination.
73 /// <exception cref="ArgumentNullException">
74 /// <paramref name="info"/> is <see langword="null"/>.
76 /// <exception cref="SerializationException">
77 /// <paramref name="info"/> is missing a required value.
79 /// <exception cref="InvalidCastException">
80 /// <paramref name="info"/> contains a value that cannot be cast to the correct type.
82 [System
.Security
.SecuritySafeCritical
]
83 protected CompositionContractMismatchException(SerializationInfo info
, StreamingContext context
)