473,414 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Microsoft FxCop 1.312

In the report of the FxCop analysis:

CriticalError, Certainty 95, for
"TypesThatOwnDisposableFieldsShouldBeDisposabl e"
{
Target : "Receiver" (IntrospectionTargetType)
Resolution : "Implement IDisposable on 'Receiver' as it instantiates members
of the following IDisposable types: System.Net.Sockets.Socket"
Help :
"http://www.gotdotnet.com/team/fxcop/docs/rules.aspx?version=1.312&&url=/Design/TypesThatOwnDisposableFieldsShouldBeDisposable.htm l" (String)
Category : "Microsoft.Design" (String)
RuleFile : "Design Rules" (String)
Info : "Types that declare disposable members should also implement
IDisposable. If the type does not own any unmanaged resources, do not
implement a finalizer on it."
Status : Active (MessageStatus)
Fix Category : Breaking (FixCategories)
}

But Socket has the Dispose method as protected so I can not invoke it.
Should I or shouldn't I Implement IDisposable in this case???
--
Thanks
Sharon
Nov 17 '05 #1
1 1940
The protected Socket.Dispose method that takes a boolean is not actually the
Socket's implementation of the IDisposable.Dispose method. Socket uses an
explicit implementation, so you would need to cast to IDisposable to call
Dispose. However, the Socket.Close method does exactly this, so you can
simply call that instead.

"Sharon" <Sh****@discussions.microsoft.com> wrote in message
news:25**********************************@microsof t.com...
In the report of the FxCop analysis:

CriticalError, Certainty 95, for
"TypesThatOwnDisposableFieldsShouldBeDisposabl e"
{
Target : "Receiver" (IntrospectionTargetType)
Resolution : "Implement IDisposable on 'Receiver' as it instantiates
members
of the following IDisposable types: System.Net.Sockets.Socket"
Help :
"http://www.gotdotnet.com/team/fxcop/docs/rules.aspx?version=1.312&&url=/Design/TypesThatOwnDisposableFieldsShouldBeDisposable.htm l"
(String)
Category : "Microsoft.Design" (String)
RuleFile : "Design Rules" (String)
Info : "Types that declare disposable members should also implement
IDisposable. If the type does not own any unmanaged resources, do not
implement a finalizer on it."
Status : Active (MessageStatus)
Fix Category : Breaking (FixCategories)
}

But Socket has the Dispose method as protected so I can not invoke it.
Should I or shouldn't I Implement IDisposable in this case???
--
Thanks
Sharon

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Crocker Data Processing | last post by:
Hi. I've written a bunch of custom rules for FxCop version 1.23, and today happened to download and install (separately) the new FxCop 1.321. Arrgghh ! The new introspection stuff is a lot...
0
by: Chua Wen Ching | last post by:
Hi there, I am super confuse on this recommendation by FxCop. 1) http://www.gotdotnet.com/team/fxcop/docs/rules/UsageRules/OperatorEqualsOverridesRequireEqualsOverridel.html First of all,...
2
by: Uri Dor | last post by:
Hi, everyone, The question is whether there is (or can be) an FxCop rule that makes sure I don't do this: String.Format("{0}-{1}-{2}", 5); Or similar things. Some explanations: 1) of course I...
7
by: steve bull | last post by:
If I create an array, e.g. private int x, inside a parent class whose elements can be accessed by a child class - what is the recommended way of doing this? When I create a property for the array...
8
by: hansiman | last post by:
Just beginning using FxCop in my asp.net projects... I get a lot of error messages under the header: AvoidUnusedParameters for funtions and routines lik: Sub isUserAuthenticated(ByVal...
4
by: Bruce One | last post by:
Given a project with some .cs files, Is there a way to block some of these files to be read by FxCop ?
10
by: Karsten Schramm | last post by:
I would write BaseClass var; ..... if(var is DerivedClass) { DerivedClass derivedVar = (DerivedClass)var; DoSomething(derivedVar); }
6
by: John Wright | last post by:
I ran FxCop against a program and was pleased with the security review except I get the following error: Do not indirectly expose methods How would I fix this code so this error goes away. I...
3
by: AlexS | last post by:
When I implement Dispose pattern in object implementing IDisposable, current fxcop recommends: Ensure that Wrapper.Dispose():Void is declared as public and sealed. However, if I do as it asks,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.