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 2 2952
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.co m
"Uri Dor" <ta****@newsgro ups.nospam> wrote in message
news:eD******** ******@TK2MSFTN GP15.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
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.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 write like a property rather than method to this:
|
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 C# and it works OK in .NET
2.0 except for two warnings from CodeAnalysis:
CA2123 : Microsoft.Security : The virtual method
DateTimePicker.WndProc(Message&):Void defined by type
'System.Windows.Forms.DateTimePicker' and its override
|
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 blnLoggedIn As Boolean)
If Not (blnLoggedIn) Then
System.Web.HttpContext.Current.Response.Redirect(pcPageLogin)
End If
|
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 know that even the form
generated code isn't FxCop "safe" in the 1.1 DNF but apparently 2.0 will be.
Until then... can someone explan to me what needs to be fixed?
The button in this example is a simple one called cmdClear.
thanks
Eric
|
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 stuff
| |
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
statement.
To test this, I added messageboxes in all constructors indicating which
constructor is called.
There are four constructors which could be called:
1. Base class empty constructor
2. Base class 2-Par. constructor
|
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, what should these
|
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 is as follows
Warning CA2122 : Microsoft.Security : MyClass.Method():Void calls into
Marshal.GetExceptionPointers():IntPtr which has a LinkDemand. By making this
call, Marshal.GetExceptionPointers():IntPtr is indirectly exposed to user
code....
|
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 think I understand the
error, but not the fix. I really need to fix this as it is called from
other programs and I do not want code elevating privileges in this function.
Thanks.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |