roslyn-code-analysis Questions

1

Solved

I'm attempting to develop a source generator to auto-implement an interface on partial classes with that interface. I believe this has to be a common use case for Microsoft's new Source Generators,...
Blanketing asked 17/6, 2021 at 13:6

4

Solved

I've got a custom code analysis ruleset that I want to apply to all configurations of multiple projects in my solution but can't see how I can do it. To be clear, I'm looking for a way (if any) of...

0

My Goal My team decided, that they wanted to incorporate automation to enforce coding guidelines in .razor files. Since we're already using StyleCopAnalyzers, I might implement our own Analyzer to ...
Franklyn asked 30/4, 2021 at 12:51

1

Solved

I have a method that is called by an external api that is expecting the method to have these specific parameters public static bool DoSomething( int x, int y ) => true; Rosyln code analysi...
Teocalli asked 8/2, 2021 at 18:30

4

Solved

Short question: How to setup a roslyn code analyzer project with a working unit-test project in Visual Studio 2019 v16.6.2? A few months (and a few Visual Studio updates) ago I experimented with se...
Energid asked 29/6, 2020 at 12:43

2

Solved

Is it possible to know with Roslyn if a Symbol is the implementation of something in an interface? For example Dispose() in IDisposable? I have a symbol that represents the Dispose() method, but a...
Recalesce asked 6/2, 2017 at 18:32

2

Solved

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, properties, etc) I want to be abl...
Outweigh asked 12/1, 2016 at 15:15

1

Solved

I get this exact warning many time in the Error List pane in VS 2019 (v16.4.2). How can i resolve the warnings ? AD0001 Analyzer 'Microsoft.CodeAnalysis.CSharp.Analyzers.FixAnalyzers.CSharpFixerW...
Chatelaine asked 9/1, 2020 at 14:56

2

Solved

For test purposes, I need to get a System.Reflection.Assembly from a string source which contains a source code. I am using Roslyn: SyntaxTree tree = CSharpSyntaxTree.ParseText(source); CSharpComp...
Compiler asked 31/3, 2017 at 12:38

3

The Roslyn Analyzers are installed as nuget packages, which are dependencies of the FxCop Analyzers (also installed as nuget packages). I have enabled full solution analysis as instructed here: H...
Jardena asked 7/6, 2019 at 22:4

1

Note I've also asked this question (with reproduction code) on Roslyn's GitHub Create a new solution with 2 projects (CoreLibrary and DownstreamLibrary). Add a project reference from DownstreamLi...
Diverticulum asked 30/5, 2019 at 22:4

1

I want to generate code analysis report from the Build Pipeline. I have recently moved from Fxcopcmd.exe to Roslyn based analyzers. I am able to see warnings in the build log, but I am not able to ...

3

Solved

I have a couple of projects where under Dependencies there are one or two branches of code analyzers like this: I tried the right mouse click on every branch as explaind here but there is no opt...
Uchida asked 29/11, 2018 at 15:45

1

Solved

In VS 2019, unused parameters are now showing two issues in the "Error List" instead on one: CA1801, which appears as a warning, and IDE0060, which appears as a suggestion. Do these analysis rules...
Landes asked 18/6, 2019 at 14:53

5

Solved

Since upgrading to VS 2015, my team has experienced random quirky things which I'm sure are being worked out at Microsoft right now. One pretty annoying one is that we seem to lose project referenc...

2

Solved

Our team uses the Code Analysis feature with a custom ruleset to cause our build to fail if we forget to do things like null checks on method arguments. However, now as we create a new .NET Core p...
Virginity asked 23/6, 2017 at 16:47

2

Solved

I'm toying with getting our team and projects ready for VS 2019. Right away, trying to set up Code Analysis for a new project, I find this: So, if this is deprecated (and apparently can't even b...

1

Solved

I want to install code analysis in one of my C# projects, and it seems that the way people add code analysis to .NET Core projects is by using the NuGet package Microsoft.CodeAnalysis.FxCopAnalyzer...
Archiearchiepiscopacy asked 15/4, 2019 at 6:57

2

Solved

There is some way to add a member to a class with roslyn? I want to add : public int number {get;set;} UPDATE I used this code: PropertyDeclarationSyntax o = SyntaxFactory.PropertyDeclaratio...
Surgeonfish asked 18/7, 2017 at 7:55

1

I am trying to find all the references of a type symbol using FindReferencesAsync. It works well for references within a C# project; however, cross-project references don't appear. Here is the code...
Cohbath asked 11/2, 2019 at 11:8

2

I'm trying to install an update through NuGet: Microsoft.AspNetCore.Mvc 1.1.2 --> 2.0.4 However, the update never succeeds as it is rolled back after encountering the following conflict: Ver...
Talent asked 16/5, 2018 at 14:4

0

I'm working on a little piece of roslyn code to try to do some simple refactorings, inside a Visual Studio for MAC extension project. I want to refactor this code: public class Test { private co...
Surcease asked 14/2, 2019 at 11:5

4

Solved

Since Visual Studio 2017 version 15.8 we have on some computers in my team the following really weird build error. Additionally Visual Studio recognizes it but the IDE itself doesn't crash. ...
Orbit asked 22/8, 2018 at 14:37

3

I'm unable to find a good option for my Visual Studio 2017. I tried right clicking the projects, but there wasn't an option for "Analyze". Just a few hours ago, I installed "Roslyn Code Analysis"...
Celle asked 23/7, 2017 at 15:49

1

Solved

I do some research on stackoverflow but I can't find the result I need. My problem is "How to determine line code's position of a source file by using Roslyn". For example: I have a source file (na...
Punic asked 18/7, 2018 at 2:27

© 2022 - 2025 — McMap. All rights reserved.