tagged [code-analysis]
CSharpAddImportCodeFixProvider encountered an error and has been disabled
CSharpAddImportCodeFixProvider encountered an error and has been disabled I had my PC re-imaged for me. I have Visual Studio Version 14.0.25123.00 Update 2 installed on my computer. I'm getting this e...
- Modified
- 30 Dec at 10:44
Is Code Contracts failing to spot obvious relationship between Nullable<T>.HasValue and null?
Is Code Contracts failing to spot obvious relationship between Nullable.HasValue and null? I am experimenting with applying Code Contracts to my code and I've hit a perplexing problem. This code is fa...
- Modified
- 27 Jul at 15:55
CA2000 when Returning Disposable Object from Method
CA2000 when Returning Disposable Object from Method I have a factory method that builds objects that implement `IDisposable`. Ultimately it is the callers that manage the lifetime of the created objec...
- Modified
- 6 Nov at 10:14
Finding all references to a method with Roslyn
Finding all references to a method with Roslyn I'm looking to scan a group of .cs files to see which ones call the `Value` property of a `Nullable` (finding all references). For example, this would ma...
- Modified
- 6 Aug at 17:29
Understanding code metrics
Understanding code metrics I recently installed the Eclipse Metrics Plugin and have exported the data for one of our projects. It's all very good having these nice graphs but I'd really like to unders...
- Modified
- 1 Oct at 01:0
C# Call Graph Generation Tool
C# Call Graph Generation Tool I just got a heaping pile of (mostly undocumented) C# code and I'd like to visualize it's structure before I dive in and start refactoring. I've done this in the past (in...
- Modified
- 13 Sep at 12:41
CA1001 implement IDisposable on async method
CA1001 implement IDisposable on async method Consider following code: When I run
- Modified
- 4 Jan at 12:41
Viewing Code Coverage Results outside of Visual studio
Viewing Code Coverage Results outside of Visual studio I've got some unit tests, and got some code coverage data. Now, I'd like to be able to view that code coverage data outside of visual studio, say...
- Modified
- 6 Jun at 14:27
Detect Recursive calls in C# code
Detect Recursive calls in C# code I want to find all recursive calls in my code. If I open file in Visual Studio, I get "Recursive call" icon on left side of Editor. ![enter image description here](ht...
- Modified
- 6 Aug at 12:21
Alternative to nested type of type Expression<Func<T>>
Alternative to nested type of type Expression> I have a function used when calling a service. Before it call the service, it will create a log entry:
- Modified
- 7 Jun at 01:42
How to force MSBuild to run Code Analysis without recompiling
How to force MSBuild to run Code Analysis without recompiling By default, code analysis is only done for projects which are compiled. So when I run MSBuild from the command line, it runs code analysis...
- Modified
- 25 Sep at 09:5
C# - StyleCop - SA1121: UseBuiltInTypeAlias - Readability Rules
C# - StyleCop - SA1121: UseBuiltInTypeAlias - Readability Rules Not found it in StyleCop Help Manual, on SO and Google so here it is ;) During StyleCop use I have a warning: > SA1121 - UseBuiltInTypeA...
- Modified
- 19 Jun at 09:24
What static analysis tools are available for C#?
What static analysis tools are available for C#? What tools are there available for static analysis against C# code? I know about FxCop and StyleCop. Are there others? I've run across NStatic before b...
- Modified
- 15 Oct at 21:52
Getting type from a symbol in roslyn
Getting type from a symbol in roslyn What is the best general purpose way to get a System.Type from Microsoft.CodeAnalysis.ISymbol for different types of symbols ? (e.g. class declarations, variable, ...
- Modified
- 18 May at 17:31
Finding all methods that handle form events using NDepend
Finding all methods that handle form events using NDepend I was wondering if someone would be able to help me write a CQL query for NDepend that will show me all the methods in my form class that hand...
- Modified
- 12 Nov at 03:59
Correct way to check the type of an expression in Roslyn analyzer?
Correct way to check the type of an expression in Roslyn analyzer? I'm writing a code analyzer with Roslyn, and I need to check if an `ExpressionSyntax` is of type `Task` or `Task`. So far I have this...
- Modified
- 30 Jan at 16:21
CA2101 Warning when making extern calls
CA2101 Warning when making extern calls I'm using the WinPcap libraries and have set up all my native method calls. Upon building I get the [CA2101: Specify marshaling for P/Invoke string arguments](h...
- Modified
- 13 Nov at 22:20
CA2213 warning when using ?. (null-conditional Operator) to call Dispose
CA2213 warning when using ?. (null-conditional Operator) to call Dispose I'm implementing `IDisposable`, and in my `Dispose()` method when calling `Dispose()` on other managed resources I'm using the ...
- Modified
- 9 Aug at 00:17
False CA1812 warning : "internal class that is apparently never instantiated..."
False CA1812 warning : "internal class that is apparently never instantiated..." I am getting a code analysis warning that seems to be a false-positive. > CA1812 : Microsoft.Performance : 'MyClass.MyP...
- Modified
- 8 Nov at 18:8
How to suppress StyleCop error SA0102 : CSharp.CsParser : A syntax error has been discovered in file when using generic type parameters attributes
How to suppress StyleCop error SA0102 : CSharp.CsParser : A syntax error has been discovered in file when using generic type parameters attributes Having the following C# code with generic type parame...
- Modified
- 21 Jan at 02:44
When to use SemanticModel.GetSymbolInfo and when SemanticModel.GetDeclaredSymbol
When to use SemanticModel.GetSymbolInfo and when SemanticModel.GetDeclaredSymbol In some cases, when I'm trying to get the the ISymbol for my syntax node, I'm fail (getting null) when using SemanticMo...
- Modified
- 29 May at 10:20
Disabling/Fixing Code Analysis warnings from .Designer.cs files
Disabling/Fixing Code Analysis warnings from .Designer.cs files I am using `DataVisualization.Charting.Chart` extensively, and for the most part it is working. However, I've been running Code Analysis...
- Modified
- 8 Aug at 19:40
CA2202, how to solve this case
CA2202, how to solve this case Can anybody tell me how to remove all CA2202 warnings from the following code? ``` public static byte[] Encrypt(string data, byte[] key, byte[] iv) { using(MemoryStr...
- Modified
- 14 May at 15:50
Why do I get Code Analysis CA1062 on an out parameter in this code?
Why do I get Code Analysis CA1062 on an out parameter in this code? I have a very simple code (simplified from the original code - so I know it's not a very clever code) that when I compile in Visual ...
- Modified
- 19 May at 11:33
How to add parameters to generated method in Roslyn ( Microsoft.CodeAnalysis )? - Need exact syntax
How to add parameters to generated method in Roslyn ( Microsoft.CodeAnalysis )? - Need exact syntax Below is the function I'm using to generate a simple method - ``` //NOTE : SF = SyntaxFactory Li...
- Modified
- 22 Apr at 11:23