This is a discussion on Rule for generated code is ignored in FxCop 1.36 when it shouldn't be within the C# Programming forums, part of the Software Development category; Rule for generated code is ignored in FxCop 1.36 when it shouldn't be I have a custom rule ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Rule for generated code is ignored in FxCop 1.36 when it shouldn't be I have a custom rule that checks generated code. The "Suppress analysis results against generated code" project setting is unchecked so I am expecting the rule to check the generated code. But it doesn't. It works fine in FxCop 1.35. It works fine when the offending code is not in a class with the CompilerGenerated attribute. The rule itself checks for code that constructs new ResourceManager objects. This happens in strongly typed resource classes when you use the default ResXFileCodeGenerator Custom Tool. If you change the Custom Tool to a different value you can generate different code (i.e. code that doesn't construct ResourceManager objects). My rule checks to see if the code uses a ResourceManager and therefore the Custom Tool setting is incorrect for my purposes. I would argue that it is valid to check for compiler generated code in this context because the generated code *can* be changed (by changing the Custom Tool). Can someone confirm if FxCop 1.36 is specifically ignoring code generated for .resx files and ignoring the "Suppress analysis results against generated code" setting ?
__________________ Shaalini.S ![]() Be the Best of Whatever you are... |
|
#2
| |||
| |||
| Hi, There is two kinds of generated code: Tool generated code, with attribute [System.CodeDom.Compiler.GeneratedCode("ToolName", "1.1.1")], and compiler generated code, with attribute [System.Runtime.CompilerServices.CompilerGenerated( )]. In FxCop1.36. FxCop will always ignore Compiler Generated code ([System.Runtime.CompilerServices.CompilerGenerated( )]). The suppress generated code is for tool generated code. Btw, why you are using CompilerGenerated instead of GeneratedCode? because it sounds like actually GeneratedCode. |
|
#3
| |||
| |||
| Hi, Thanks for the clarification. > FxCop will always ignore Compiler Generated code ([System.Runtime.CompilerServices.CompilerGenerated( )]). Ok, so I am saying that this needs to be configurable because there are legitimate cases where FxCop must be able to analyze this code. > Btw, why you are using CompilerGenerated instead of GeneratedCode? because it sounds like actually GeneratedCode. It's not my code - it's Visual Studio's code. It comes from the ResXFileCodeGenerator (and others) that is used by Visual Studio to generate strongly typed resource classes. I need to be able to run FxCop rules over this code for the reasons given in my previous post. Could you make this change ?
__________________ Shaalini.S ![]() Be the Best of Whatever you are... |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FxCop 1.36: 'Referenced assembly could not be found' for assemblies in GAC | arjkhanna | C# Programming | 1 | 06-18-2009 03:21 AM |
| FxCop 1.36 and theGlobalSuppression.cs | shaalini | C# Programming | 7 | 06-17-2009 11:44 PM |
| !important rule in CSS | velhari | HTML, CSS and Javascript Coding Techniques | 3 | 12-01-2007 12:57 AM |
| What are the different tables present in mysql, which type of table is generated when | oxygen | Database Support | 2 | 07-26-2007 02:37 AM |
| navigate pages generated from the select query | hanusoftware | PHP Programming | 0 | 06-22-2007 12:20 AM |
Our Partners |