473,406 Members | 2,713 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,406 software developers and data experts.

Can FxCop check my calls to String.Format etc. for parameter countmatch?

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 only mean cases where the format string is a constant
string literal in the code - that's 99% of the cases anyway
2) similar cases are Console.Write(), etc., I know
Nov 16 '05 #1
2 2930
Uri,

I don't think that there is a rule in there for that. However, FXCop is
extensible, and you can easily write your own rules. Check out the
gotdotnet.com workspace for it, located at (watch for line wrap):

http://www.gotdotnet.com/team/fxcop/

Check out the section titled "FxCop User Samples".

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Uri Dor" <ta****@newsgroups.nospam> wrote in message
news:eD**************@TK2MSFTNGP15.phx.gbl...
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 only mean cases where the format string is a constant
string literal in the code - that's 99% of the cases anyway
2) similar cases are Console.Write(), etc., I know

Nov 16 '05 #2
Thanks, Nicholas, but actually...
I tried today and didn't see a single sample there.

Nicholas Paldino [.NET/C# MVP] wrote:
Uri,

I don't think that there is a rule in there for that. However, FXCop is
extensible, and you can easily write your own rules. Check out the
gotdotnet.com workspace for it, located at (watch for line wrap):

http://www.gotdotnet.com/team/fxcop/

Check out the section titled "FxCop User Samples".

Hope this helps.

Nov 16 '05 #3

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

Similar topics

5
by: Chua Wen Ching | last post by:
I had use fxcop to check my code. I had 1 confusion here. I would normally call a method by this way in my IAnimal: Example: public void CallFuncA(ushort port); But fxcop says i need to...
2
by: orekinbck | last post by:
Hi There I am inheriting from DateTimePicker class to create a DateTimePicker control with a configurable back colour. I got the original code from http://dotnet.mvps.org/ then converted it to...
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...
2
by: Eric Sabine | last post by:
I'm running FX Cop on my assembly and on a form, tons of my labels and buttons are being flagged with this error. I don't really get the error and what I am supposed to do to resolve the error. I...
3
by: Charles Law | last post by:
I have just run FxCop and it reported a problem line 2 of the following: <code> Select Case e.Tool.Key.ToUpper Case "FirstOption".ToUpper ' Do stuff Case "SecondOption".ToUpper ' Do other...
1
by: John | last post by:
Hi, Maybe someone can help me with the following: "The first task by any derived class constructor is to call it’s direct or indirect base class constructor implicitly or explicitly", reads the...
3
by: Velvet | last post by:
I ran FxCop on one of the components for my web site and the security rules what me to add " tags like the ones listed below: This breaks my ASP.NET application. So my question is,...
5
by: Peter Ritchie [C# MVP] | last post by:
I've purposely been ignoring a CA2122 warning in some C++ interop code I've been working on for quite some time. I've just recently had the cycles to investigate the warning. The warning message...
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.