roslyn Questions

1

I've written an Roslyn Analyzer for a specific C# Solution and want to add the analyer to all projects in the solution via ProjectReference: <Project> <PropertyGroup> <LangVersion&...
Presidency asked 14/12, 2021 at 18:6

3

Solved

I try to get the named arguments for MyAttribute with Roslyn. var sourceCode = (@" public class MyAttribute : Attribute { public string Test { get; set; } } [MyAttribute(Test = ""Hello"")] ...
Xantho asked 6/3, 2018 at 10:54

2

Solved

How can I unload an assemlby in .NET Core ? Note: .NET Core does not support AppDomains. Background: I have to evaluate user-generated VisualBasic expressions dynamically. So to do this, I d...

0

This question is related to How to speed up aspnet_compiler.exe? The answer mentions using Roslyn instead and provides the link to this post - https://devblogs.microsoft.com/dotnet/enabling-the-net...
Masorete asked 17/12, 2021 at 4:12

1

I'm attempting to write a unit test to test a Roslyn analyzer code fix. Things have moved on since the introduction of analyzers and editing DiagnosticVerifier.Helper.cs is no longer the way ( http...
Antevert asked 3/1, 2021 at 13:34

7

Solved

This one seems to be originated after upgrading from vs2015 to vs2017. The error is Compiler Error Message: The compiler failed with error code -532462766. Some notes.. It works great on ...
Count asked 10/4, 2017 at 16:10

5

Solved

I am trying to write a C# interactive script (.csx) that needs to use a NuGet package, but I must be overlooking something fundamental because I can't get it to work. I tried adding a project.json...
Intro asked 21/1, 2016 at 9:55

1

I am attempting to write a C# source generator that throws a warning/error under certain conditions using GeneratorExecutionContext.ReportDiagnostic. My source generator is able to run and output e...

6

Solved

CodeDomProvider objCodeCompiler = CodeDomProvider.CreateProvider( "CSharp" ); CompilerParameters objCompilerParameters = new CompilerParameters(); ... CompilerResults objCompileResults = objCode...
Nicolanicolai asked 26/7, 2015 at 17:0

2

Solved

I am writing a source generator but am struggling to get the value of an argument passed to the constructor of my attribute. I inject the following into the compilation: namespace Richiban.Cmdr { ...
Whitsunday asked 5/11, 2021 at 12:28

3

Solved

I have been scouring all possible documentation I could find about the Roslyn APIs but I could not find an answer to this simple question. I know a CodeFix inherits from CodeFixProvider and provid...
Gilliam asked 3/7, 2018 at 10:37

6

Solved

Is there a way to use bold or italic inside documentation comments? Something like: /// <summary>Cleanup method. This is <b>recommended</b> way of cleanup.</summary> publi...
Lex asked 7/6, 2016 at 8:53

1

This question is also asked here: https://github.com/dotnet/roslyn/issues/57292 In Roslyn 3.8.0, there is RS2008 warning (Enable analyzer release tracking for the analyzer project containing rule '...
Cherisecherish asked 21/10, 2021 at 4:2

1

I have just developed a small internal application and I'm using Octopus Deploy as the deployment software. I've been using Octopus for a number of years now without issue. However, I've just hit a...
Avelar asked 20/1, 2020 at 15:36

1

I have a library that relies on a source generator to work correctly. In the MyLibrary.csproj, I reference the generator like so. <ItemGroup> <ProjectReference Include="..\MyLibrar...
Boondocks asked 23/2, 2021 at 7:17

2

Solved

In F# it's rather easy with predefined identifier __SOURCE_DIRECTORY__ https://mcmap.net/q/489283/-f-for-scripting-location-of-script-file However this identifier does not work in C# scripting (cs...
Catlee asked 13/10, 2017 at 11:26

1

Solved

I've recently seen using CSharpCodeProvider is deprecated in .NET Core 5. I was wondering if there was a smart way to combine multiple files into one dll from which I can load up using Rosyln inste...
Sarver asked 5/9, 2020 at 1:37

1

Solved

I want to implement interfaces in my code generator, so I need to convert Microsoft.CodeAnalysis.Accessibility (i.e. from ISymbol.DeclaredAccessibility) to their represented modifier keywords. This...
Fara asked 4/9, 2021 at 0:28

1

Solved

What I like about the dotnet CLI is that you can run $ dotnet build --no-incremental, and you always get a list of all the warnings in your project. I use that for making sweeping changes, and such...
Lees asked 29/8, 2021 at 19:56

1

I can't figure out how to ship a .Net library that also includes a Roslyn source generator, and have the source generator access the source code of the main project, without adding an explicit refe...
Tabitha asked 24/8, 2021 at 4:7

3

Solved

I started using C# Interactive and like the fact that I can browse and explore some API functionalities like I do with Immediate without the need to run and debug my program. The problem is that i...

0

TL;DR How to reference custom Roslyn code generators from Unity? How reliable are local "conventional" projects? How to reference "conventional" dotnet projects in Unity? Ca...
Damal asked 1/7, 2021 at 14:48

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

5

Is there at last a easy way to execute c# script file from command line? I saw that discussion on github and according to this thread i think dotnet run Test.cs should do the job. But for my tes...
Bungalow asked 30/5, 2016 at 11:0

3

Can the Roslyn C# compiler be used to compile C# to CIL human readable code? Like the examples shown here : https://en.wikipedia.org/wiki/Common_Intermediate_Language I know it can produce bytecod...
Evvie asked 19/7, 2017 at 12:17

© 2022 - 2025 — McMap. All rights reserved.