MsmqPoisonMessageException.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.ServiceModel
  5. {
  6. using System.Runtime;
  7. using System.Runtime.Serialization;
  8. using System.Security;
  9. using System.Security.Permissions;
  10. [Serializable]
  11. public class MsmqPoisonMessageException : PoisonMessageException
  12. {
  13. long messageLookupId = 0;
  14. public MsmqPoisonMessageException() { }
  15. public MsmqPoisonMessageException(string message) : base(message) { }
  16. public MsmqPoisonMessageException(string message, Exception innerException) : base(message, innerException) { }
  17. public MsmqPoisonMessageException(long messageLookupId) : this(messageLookupId, null) { }
  18. public MsmqPoisonMessageException(long messageLookupId, Exception innerException)
  19. : base(SR.GetString(SR.MsmqPoisonMessage), innerException)
  20. {
  21. this.messageLookupId = messageLookupId;
  22. }
  23. public long MessageLookupId
  24. {
  25. get { return this.messageLookupId; }
  26. }
  27. protected MsmqPoisonMessageException(SerializationInfo info, StreamingContext context)
  28. : base(info, context)
  29. {
  30. this.messageLookupId = (long)info.GetValue("messageLookupId", typeof(long));
  31. }
  32. #pragma warning disable 688 // This is a Level1 assembly: a Level2 [SecurityCrital] on public members are turned into [SecuritySafeCritical] + LinkDemand
  33. [Fx.Tag.SecurityNote(Critical = "Overrides the base.GetObjectData which is critical, as well as calling this method.",
  34. Safe = "Replicates the LinkDemand.")]
  35. [SecurityCritical]
  36. [SecurityPermissionAttribute(SecurityAction.LinkDemand, SerializationFormatter = true)]
  37. public override void GetObjectData(SerializationInfo info, StreamingContext context)
  38. {
  39. base.GetObjectData(info, context);
  40. info.AddValue("messageLookupId", this.messageLookupId);
  41. }
  42. #pragma warning restore 688
  43. }
  44. }