fxcop

Using Microsoft.Bcl.Async with Code Analysis causes errors

ⅰ亾dé卋堺 提交于 2019-11-30 03:44:46
I'm trying to use Microsoft.Bcl.Async and Code Analysis, but when I run Code Analysis I get one or more errors. I'm using Visual Studio 2012 with Update 2. This is easy for me to reproduce: Create a new default Console App that targets .Net 4 . Right click References then select Manage NuGet Packages... Click Online and type async into the Search Online box. You should see Async for .Net Framework 4 ... . Click Install and accept all questions. Add to Main() a line that says: TaskEx.Delay(1000); and a using System.Threading.Tasks; Go to project properties, Code Analysis section and tick Enable

Is there a StyleCop/FxCop autofixing tool? [closed]

旧城冷巷雨未停 提交于 2019-11-30 01:28:27
Is there a tool that can automatically fix StyleCop and FxCop rules, rather than manually fixing thousands of warning and errors? There must be one, it is such a good business opportunity! No, frustratingly . That's why Style Cop is counter-productive. Consistent formatting looks nice, but there's little productivity benefit to it (what really makes code hard to read is length and indirection ). Perfect spacing is not worth spending hours adjusting lines by hand. If there were an automated tool to achieve consistent formatting, I might hook it up post-check-in. But Style Cop is made by sadists

FxCop indirect reference to System.Core version 2.0.5.0

自作多情 提交于 2019-11-29 14:42:00
I've got a project that uses Autofac, and the WebAPI integration We run FxCop over our solution, and on opening autofac, I get the following: The following indirectly-referenced assembly could not be found. This assembly is not required for analysis, however, without it, analysis results could be incomplete. This assemble was referenced by Autofac.dll System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes This causes the following error on our CI server: FxCop return code (516): PROJECT_LOAD_ERROR ASSEMBLY_REFERENCES_ERROR Is there a way to tell FxCop

Excluding Code Analysis rule in source

家住魔仙堡 提交于 2019-11-29 11:14:54
问题 In a project I'm working on FxCop shows me lots of (and I mean more than 400) errors on the InitializeComponent() methods generated by the Windows Forms designer. Most of those errors are just the assignment of the Text property of labels. I'd like to suppress those methods in source, so I copied the suppression code generated by FxCop into AssemblyInfo.cs, but it doesn't work. This is the attribute that FxCop copied to the clipboard. [module: SuppressMessage("Microsoft.Globalization",

What's the proper naming convention for a property 'ID' : ID or Id?

穿精又带淫゛_ 提交于 2019-11-29 06:19:59
问题 Pretty simple question: When i have a persistable object, it usually has a property called ID (for abstract classes). So .. is the naming convention ID or Id? eg. public int ID { get; set; } or public int Id { get; set; } cheers :) PS. This is for .NET btw. FXCop conformat would be a bonus. 回答1: I usually go with Identifier . If I really want to keep it short (as part of a longer identifier, for example), I use Id, unless it's a parameter or private member. The .NET Framework Naming

Nested using statements and Microsoft code Analyses

99封情书 提交于 2019-11-29 05:15:30
问题 Recently I switched on additional code analyses rules. To my surprise I saw a violation in a place I was always considering as the best practice. If I have two nested disposables I am putting two using statements like this: using (StringReader strReader = new StringReader(xmlString)) using (XmlReader xmlReader = XmlReader.Create(strReader)) { result.ReadXml(xmlReader); } This also corresponds to the high rated Q&A Nested using statements in C# The violation I get states following: Warning 18

FxCop for .NET 4.0

若如初见. 提交于 2019-11-29 04:38:54
问题 I know Visual Studio 2010 has a new Code Analysis tool built in, but that is only for the premium and ultimate editions. From what I can see the latest FxCop supports .NET 3.5 SP1. Searching I wasn't able to find any references to an FxCop for .NET 4.0. Is there plans to continue to offer FxCop and for it to support .NET 4.0? Where would I find more information about it and download it? 回答1: The latest version of FXCop (v10) is bundled with the install of the latest Windows SDK for Windows 7

Using Microsoft.Bcl.Async with Code Analysis causes errors

假装没事ソ 提交于 2019-11-29 00:48:43
问题 I'm trying to use Microsoft.Bcl.Async and Code Analysis, but when I run Code Analysis I get one or more errors. I'm using Visual Studio 2012 with Update 2. This is easy for me to reproduce: Create a new default Console App that targets .Net 4 . Right click References then select Manage NuGet Packages... Click Online and type async into the Search Online box. You should see Async for .Net Framework 4 ... . Click Install and accept all questions. Add to Main() a line that says: TaskEx.Delay

How to get the FxCop custom dictionary to work?

℡╲_俬逩灬. 提交于 2019-11-28 22:22:32
How is it possible to get the FxCop custom dictionary to work correctly? I have tried adding words to be recognised to the file 'CustomDictionary.xml', which is kept in the same folder as the FxCop project file. This does not seem to work, as I still get the 'Identifiers should be spelled correctly' FxCop message, even after reloading and re-running FxCop. Using version 1.36. If you use it inside Visual Studio... From Visual Studio Code Analysis Team Blog To add a custom dictionary to a C# and Visual Basic project is simple: In Solution Explorer, right-click on the project and choose Add ->

Stylecop vs FXcop

浪尽此生 提交于 2019-11-28 15:33:36
Has Stylecop superseded FXcop? Which product should we be using with Visual Studio 2008? Stylecop is a style analysis tool that works at the source code level. It exists primarily to provide a single common style that managed projects can use to remain consistent within the larger world of managed software. It makes decisions regarding style primarily to avoid holy wars (after all, style is almost always an inherently subjective thing). I don't think I've ever met someone who liked all of StyleCop's rules, but that's ok . It means that StyleCop is a generally good compromise amongst the vast