PC Review


Reply
Thread Tools Rate Thread

Code Analysis; CA2000 Question (g__initLocal8)

 
 
NvrBst
Guest
Posts: n/a
 
      23rd Sep 2010
::Error::
CA2000 : Microsoft.Reliability : In method '*', object
'<>g__initLocal8' is not disposed along all exception paths. Call
System.IDisposable.Dispose on object '<>g__initLocal8' before all
references to it are out of scope.

::Code::
using(FolderBrowserDialog sourceFolder = new FolderBrowserDialog()
{ ShowNewFolderButton = false })
if(sourceFolder.ShowDialog(this) == DialogResult.OK)
...;

I'm assuming it is the "ShowNewFolderButton = false" part which is
causing the warning, but, I'm wondering if this really isn't safe?
From the "Show Error Help" window I can understand their example, but,
I don't have to dispose "false" in the above example.

Should I be avoiding this type of syntax when using the "using"
statement? Or is this just an Analysis bug that will probably get
fixed?

I'm using VS2010 targeting .NET Framework 4.0 Client Profile. Please
help me better understand this problem. Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CA2000 Warning call Dispose on object za Microsoft C# .NET 3 7th Jun 2010 07:05 PM
VS 2008 & Code Analysis Dune88 Microsoft Dot NET 1 28th Apr 2008 02:49 AM
Code Analysis =?Utf-8?B?Z21jY2FsbHVt?= Microsoft C# .NET 2 9th Nov 2005 07:41 PM
vs2k5 Beta2 'Code Analysis' returns warnings on generated code dbuchanan Microsoft ADO .NET 2 25th Oct 2005 11:22 AM
vs2005 beta2 'Code Analysis' returns warnings on generated code dbuchanan Microsoft VB .NET 2 23rd Oct 2005 10:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:12 PM.