roslyn Questions

3

Solved

Is there any way to suppress the issues from the Roslyn Analyzers? I use the instant analyzer project type. And I want to suppress the issues if the user wants it. Also it must be permanent. If I r...
Zoltai asked 11/1, 2016 at 11:30

3

Solved

Why is it not possible to use implicit conversion when calling an extension method? Here is the sample code: using System; namespace IntDecimal { class Program { static void Main(string[] arg...
Benbow asked 28/5, 2018 at 14:47

4

Solved

Working on an ASP.NET 5 application (Visual Studio 2015 CTP5) and Microsoft.CodeAnalysis.CSharp. If I try to create a MetadataReference to an assembly that is part of the solution to pass it as a ...
Vegetal asked 13/2, 2015 at 15:57

4

Solved

What am I doing wrong that Roslyn is generating code without any space between identifiers and keywords? It is also putting a semicolon at the end of the method block. Here is my code: SeparatedS...
Hunter asked 29/10, 2015 at 14:19

3

I'm on V16.4.1 and the project is targeting .NET Framework 4.7.1 I have a solution with multiple projects which all run fine except one which gives the above error. I searched the project and can'...
Partible asked 19/3, 2020 at 12:48

1

I am writing a program in C# for extracting comments from code. I am using Roslyn compiler to do that. It's great, because I am just visiting the whole abstract syntax tree and fetching SingleLineC...
Honorific asked 15/4, 2018 at 15:54

1

In my Roslyn analyzer I get Microsoft.CodeAnalysis.TypeInfo of an argument by var argumentTypeInfo = semanticModel.GetTypeInfo(argumentSyntax.Expression); also I have another instance of Microso...
Blinker asked 24/2, 2017 at 4:48

3

The recently-released .NET tooling seem to have support for embedding C# in PDBs, which should improve the experience of stepping into third-party, etc. Running csc /?, I can clearly see the /embed...
Igniter asked 10/3, 2017 at 9:7

1

I am writing a source generator that automatically writes JsonObject classes, that translantes JSON to run-time objects. As shown in the screenshot, you can see red wavy lines. These are CS0246. H...
Redivivus asked 7/7, 2022 at 1:55

3

Solved

I have been upgrading a project and since the latest version of Visual Studio 2019 was installed have found the following file being output to disk MyProjectName.GeneratedMSBuildEditorConfig.editor...
Sprawl asked 7/10, 2020 at 10:2

6

Solved

In old .NET we used to be able to run the csc compiler to compile a single .cs file or several files. With .NET Core we have dotnet build that insists on having a proper project file. Is there a s...
Arathorn asked 6/9, 2017 at 2:13

9

Solved

I'm trying to work with a large opensource project that has a handful of Roslyn Code Analyzers. When I open the solution Visual Studio uses ~35% CPU for about 15 minutes. Using PerfView I've figure...
Mulch asked 6/4, 2016 at 19:58

3

Solved

I´m creating a roslyn analyzer to check the usage of an attribute from my framework code. Example: Framework.csproj public class ModuleAttribute : Attribute { } Framework.Analyzer.csproj [Diagnost...
Guesthouse asked 24/10, 2022 at 9:4

2

Solved

I am trying to analyze with roslyn if a type declaration is a "Nullable Reference" type (C#8) I was planing on looking if the TypeSyntex was a NullableTypeSyntax and if the ITypeSymbol.IsReference...

2

Solved

I need to get the full CLR name of a particular symbol. This means that for generic types I need the `1, `2, etc. appended to types. Now, ISymbol already has a property MetadataName which does exac...
Proboscis asked 24/11, 2014 at 13:23

2

Solved

The following warning has suddenly turned up on my C# .Net Framework 4.8 app. I have deleted all bin and obj folders, and I've tried removing and installing the DotNetCompilerPlatfrom package, but ...
Necropsy asked 16/8, 2023 at 6:31

60

Solved

I am trying to run an ASP.NET MVC (model-view-controller) project retrieved from TFS (Team Foundation Server) source control. I have added all assembly references and I am able to build and compile...
Segno asked 25/9, 2015 at 10:36

9

Solved

F# has a REPL (read–eval–print loop) F# Interactive, C:\Program Files (x86)\Microsoft F#\v4.0\Fsi.exe. I understand C# now has its own interactive REPL, as released with Roslyn. How do I open outs...
Iseabal asked 11/6, 2012 at 13:0

4

I'm debugging a .NET 4.0 application in Visual Studio 2015. My application builds and runs fine, but when I try to edit and continue while running under the debugger, regardless of what changes I m...
Dionisio asked 28/12, 2016 at 22:33

3

Solved

I writed a SourceGenerator, but how do I test it? Main issue is how to imitate GeneratorExecutionContext (or just Compilation inside it) which generator gets into Execute method. I think there is a...
Consequence asked 12/4, 2021 at 6:56

1

Solved

During my work on a Roslyn analyzer I have received an alert from Roslyn analyzer that checks the correct usage of Roslyn API. RS1036: Specify analyzer banned API enforcement setting. A project co...
Undue asked 14/3, 2023 at 13:47

20

Solved

After installing Visual Studio 2015 and building my project I receive the error "CSC : error CS7038: Failed to emit module". However my solution is building fine in Visual Studio 2013. It is...
Omora asked 29/7, 2015 at 6:25

1

I am trying to write a Blazor WebAssembly (WASM) app that accepts some code (from some text input field) and compiles the code using Roslyn. I'm using Roslyn's CSharpCompilation class to create the...
Meilen asked 7/11, 2022 at 18:54

1

I'm creating a simple Roslyn Source Generator. The generator seems to work well in debug, correctly generating the desired class. However, when referencing it from another project in the solution, ...
Haver asked 16/1, 2023 at 11:18

1

In a .NET Core App, if I do typeof(DateTime).Assembly.Location I get C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.4\System.Private.CoreLib.dll But the documentation for the Date...
Eighteenth asked 1/6, 2020 at 8:47

© 2022 - 2024 — McMap. All rights reserved.