From 6ca3907c6faeb6b1a62cb3a3a81064db05c0b3a4 Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Sun, 13 Jul 2014 10:03:20 +0900 Subject: [PATCH] =?utf8?q?Dispose=E4=B8=8D=E8=A6=81=E3=81=AE=E3=83=A1?= =?utf8?q?=E3=82=BD=E3=83=83=E3=83=89=E3=81=ABSuppressMessage=E5=B1=9E?= =?utf8?q?=E6=80=A7=E3=82=92=E8=BF=BD=E5=8A=A0=20(CA2000)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit http://msdn.microsoft.com/ja-jp/library/ms182289.aspx --- OpenTween/Connection/Networking.cs | 4 ++++ OpenTween/EventViewerDialog.cs | 2 ++ OpenTween/MemoryImage.cs | 3 +++ OpenTween/ShortUrl.cs | 3 +++ OpenTween/TweetThumbnail.cs | 2 ++ 5 files changed, 14 insertions(+) diff --git a/OpenTween/Connection/Networking.cs b/OpenTween/Connection/Networking.cs index 8372fd65..dd8b0127 100644 --- a/OpenTween/Connection/Networking.cs +++ b/OpenTween/Connection/Networking.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; using System.Net.Http; @@ -68,6 +69,7 @@ namespace OpenTween.Connection private static ProxyType proxyType = ProxyType.IE; private static IWebProxy proxy = null; + [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] static Networking() { DefaultTimeout = TimeSpan.FromSeconds(20); @@ -119,6 +121,7 @@ namespace OpenTween.Connection /// 通常は Networking.Http を使用すべきです。 /// このメソッドを使用する場合は、WebProxyChanged イベントが発生する度に HttpClient を生成し直すように実装してください。 /// + [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] public static HttpClient CreateHttpClient(HttpClientHandler handler) { if (Networking.Proxy != null) @@ -155,6 +158,7 @@ namespace OpenTween.Connection throw new InvalidOperationException("Sequence error.(not initialized)"); } + [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] private static void OnWebProxyChanged(EventArgs e) { var newClient = Networking.CreateHttpClient(new HttpClientHandler()); diff --git a/OpenTween/EventViewerDialog.cs b/OpenTween/EventViewerDialog.cs index f5c80fcf..d8e6c581 100644 --- a/OpenTween/EventViewerDialog.cs +++ b/OpenTween/EventViewerDialog.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; +using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.Linq; using System.Text; @@ -276,6 +277,7 @@ namespace OpenTween } } + [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] private static IEnumerable CreateTabsFromUserStreamsEvent() { return Enum.GetNames(typeof(MyCommon.EVENTTYPE)) diff --git a/OpenTween/MemoryImage.cs b/OpenTween/MemoryImage.cs index 52fd8e8e..05180f9c 100644 --- a/OpenTween/MemoryImage.cs +++ b/OpenTween/MemoryImage.cs @@ -25,6 +25,7 @@ using System.Linq; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Text; +using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.IO; using System.Threading.Tasks; @@ -151,6 +152,7 @@ namespace OpenTween /// 読み込む対象となる Stream /// 作成された MemoryImage /// 不正な画像データが入力された場合 + [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] public static MemoryImage CopyFromStream(Stream stream) { var memstream = new MemoryStream(); @@ -185,6 +187,7 @@ namespace OpenTween /// 読み込む対象となるバイト列 /// 作成された MemoryImage /// 不正な画像データが入力された場合 + [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] public static MemoryImage CopyFromBytes(byte[] bytes) { return new MemoryImage(new MemoryStream(bytes)); diff --git a/OpenTween/ShortUrl.cs b/OpenTween/ShortUrl.cs index 50a3b935..79f4187d 100644 --- a/OpenTween/ShortUrl.cs +++ b/OpenTween/ShortUrl.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net.Http; using System.Text; @@ -127,6 +128,7 @@ namespace OpenTween _instance = new Lazy(() => new ShortUrl(), true); } + [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] internal ShortUrl() : this(CreateDefaultHttpClient()) { @@ -491,6 +493,7 @@ namespace OpenTween } } + [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] private static HttpClient CreateDefaultHttpClient() { var handler = new HttpClientHandler diff --git a/OpenTween/TweetThumbnail.cs b/OpenTween/TweetThumbnail.cs index a4a5dd8a..d25d9363 100644 --- a/OpenTween/TweetThumbnail.cs +++ b/OpenTween/TweetThumbnail.cs @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.Data; using System.Linq; @@ -159,6 +160,7 @@ namespace OpenTween } } + [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] protected virtual OTPictureBox CreatePictureBox(string name) { return new OTPictureBox() -- 2.11.0