fxcop

FxCop indirect reference to System.Core version 2.0.5.0

≯℡__Kan透↙ 提交于 2019-11-28 08:17:45
问题 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

Visual Studio Code Analysis vs StyleCop + FxCop

杀马特。学长 韩版系。学妹 提交于 2019-11-28 03:14:30
I used previously StyleCop + FxCop on my Visual Studio's projects. But now I am testing Visual Studio Code Analysis tool, which is easier to integrate into MSBuild, and I have found that this tools analyses some of the rules of both FxCop and StyleCop. Is this tool a full replacement for both FxCop and StyleCop or does it just implement some of their rules? Ben S Visual Studio includes FxCop + more. From the developer blog of FxCop : Sorry about my ignorance, but I assume FxCop is completely separate from the Code Analysis in VSTS? More specifically, I assume that if I install the new version

How to suppress code analysis messages for all type members?

删除回忆录丶 提交于 2019-11-27 23:38:28
Let's say I have an enumeration of all currencies: public enum CurrencyType { /// <summary> /// United Arab Emirates dirham /// </summary> [EnumMember] AED = 784, /// <summary> /// Afghan afghani /// </summary> [EnumMember] AFN = 971, /// <summary> /// Albanian lek /// </summary> [EnumMember] ALL = 008, ... } VS 2015 code analysis keeps complaining about 100 violations of CA1709 for every individual member. This is an useful rule by itself, and I do not want to disable it; yet it is of not much help in this specific case, as CurrencyType is public and is used in a whole lot of other projects.

Exclude complete namespace from FxCop code analysis?

怎甘沉沦 提交于 2019-11-27 21:57:41
Is it possible to exclude a complete namespace from all FxCop analysis while still analyzing the rest of the assembly using the SuppressMessageAttribute ? In my current case, I have a bunch of classes generated by LINQ to SQL which cause a lot of FxCop issues, and obviously, I will not modify all of those to match FxCop standards, as a lot of those modifications would be gone if I re-generated the classes. I know that FxCop has a project option to suppress analysis on generated code, but it does not seem to recognize the entity and context classes created by LINQ 2 SQL as generated code. If

Stylecop vs FXcop

不羁的心 提交于 2019-11-27 19:48:10
问题 Has Stylecop superseded FXcop? Which product should we be using with Visual Studio 2008? 回答1: 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

How to get the FxCop custom dictionary to work?

风流意气都作罢 提交于 2019-11-27 14:18:33
问题 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. 回答1: If you use it inside Visual Studio... From Visual Studio Code Analysis Team Blog To add a custom dictionary to a

How do I extend a WinForm's Dispose method?

谁说我不能喝 提交于 2019-11-27 12:58:50
I am getting this warning from FxCop: "'RestartForm' contains field 'RestartForm.done' that is of IDisposable type: 'ManualResetEvent'. Change the Dispose method on 'RestartForm' to call Dispose or Close on this field." Ok, I understand what this means and why this is what needs to be done... Except System.Windows.Forms.Form doesn't allow you to override either .Close() or .Dispose() , so what to do? Currently I'm running with this solution: private void RestartForm_FormClosing(object sender, FormClosingEventArgs e) { done.Set(); done.Close(); } Which works as intended for my application...

Visual Studio Code Analysis vs StyleCop + FxCop

谁都会走 提交于 2019-11-27 05:05:41
问题 I used previously StyleCop + FxCop on my Visual Studio's projects. But now I am testing Visual Studio Code Analysis tool, which is easier to integrate into MSBuild, and I have found that this tools analyses some of the rules of both FxCop and StyleCop. Is this tool a full replacement for both FxCop and StyleCop or does it just implement some of their rules? 回答1: Visual Studio includes FxCop + more. From the developer blog of FxCop: Sorry about my ignorance, but I assume FxCop is completely

How do I suppress FxCop rule 'DoNotCatchGeneralExceptionTypes' with SupressMessage?

☆樱花仙子☆ 提交于 2019-11-27 01:56:49
问题 I've got code that catches everything and logs it. I don't normally do this, but I'm writing an HTTP handler and want to return an appropriate HTTP code. Anyway, I'm putting the following at the top of my method: [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "We just log the exception and return an HTTP code")] FxCop is seemingly ignoring this, which is very frustrating. Especially as it's also ignoring all of my compound word overrides too!

How to suppress code analysis messages for all type members?

陌路散爱 提交于 2019-11-26 21:32:44
问题 Let's say I have an enumeration of all currencies: public enum CurrencyType { /// <summary> /// United Arab Emirates dirham /// </summary> [EnumMember] AED = 784, /// <summary> /// Afghan afghani /// </summary> [EnumMember] AFN = 971, /// <summary> /// Albanian lek /// </summary> [EnumMember] ALL = 008, ... } VS 2015 code analysis keeps complaining about 100 violations of CA1709 for every individual member. This is an useful rule by itself, and I do not want to disable it; yet it is of not