OSDN Git Service

WebApiExceptionをシリアライズに対応できるように修正 (CA2240)
authorKimura Youichi <kim.upsilon@bucyou.net>
Mon, 14 Jul 2014 05:33:53 +0000 (14:33 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Mon, 21 Jul 2014 06:27:20 +0000 (15:27 +0900)
http://msdn.microsoft.com/ja-jp/library/ms182342.aspx

OpenTween/WebApiException.cs

index 27421a8..3fd474c 100644 (file)
@@ -38,7 +38,6 @@ namespace OpenTween
         public WebApiException() : base() { }
         public WebApiException(string message) : base(message) { }
         public WebApiException(string message, Exception innerException) : base(message, innerException) { }
-        protected WebApiException(SerializationInfo info, StreamingContext context) : base(info, context) { }
 
         public WebApiException(string message, string responseText)
             : this(message)
@@ -51,5 +50,17 @@ namespace OpenTween
         {
             this.ResponseText = responseText;
         }
+
+        protected WebApiException(SerializationInfo info, StreamingContext context)
+            : base(info, context)
+        {
+            this.ResponseText = info.GetString("ResponseText");
+        }
+
+        public override void GetObjectData(SerializationInfo info, StreamingContext context)
+        {
+            base.GetObjectData(info, context);
+            info.AddValue("ResponseText", this.ResponseText);
+        }
     }
 }