Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
831 views

I have the following source code generator [Generator] public class Generator : ISourceGenerator { public void Execute(GeneratorExecutionContext context) { var output = @"using ...
Peter's user avatar
  • 38.9k
0 votes
1 answer
457 views

I have implemented a custom diagnostic rule in C# using the Roslyn API, but it is not being applied to my code. I have verified that the rule is included in the list of enabled rules in my project's ...
Mojtaba Khooryani's user avatar
0 votes
0 answers
40 views

As you can see, only the if statement gets the leading trivia and not the rest of it: Input: __Internal.DestroyContext(__arg0); Current result: if (IntPtr.Size == 4) { ...
aybe's user avatar
  • 16.8k
0 votes
1 answer
45 views

I've written a CodeAnalyzer/CodeFix using VS Community 17.4.3, and I'm trying to test them with the Visual Studio generated unit test code. The analyzer text runs successfully, and the CodeFix ...
David Killian's user avatar
1 vote
1 answer
1k views

I'm doing a C# source generator and I want the developer to influence the output of the generated types based on a class with a specified interface that he will implement. The interface is declared in ...
Adam Paquette's user avatar
3 votes
1 answer
267 views

I'm using ClassDeclarationSyntax.AddMembers() to add methods to the class. The method appears in the class, but I would like to know how to add the method to a specific place. As of now, they are ...
Yang's user avatar
  • 33
0 votes
1 answer
185 views

I try to run method by CSharpScript. Method: public class TaskSolution { public int[] Calculate(int[] inputValue) { return inputValue; } } I tried this solution: var script = ...
Sterlukin's user avatar
2 votes
1 answer
822 views

Hi I'm trying to write a SourceGenerator that uses the Humanizer package (This package is only needed while generating code and should not be added as a reference in the project that uses the ...
Peter's user avatar
  • 38.9k
2 votes
0 answers
115 views

I have two DLLs with separate code inside them, but with the same NAME and same VERSION. Neither of these can be changed. They are in two separate C# projects, which do not reference each other, but ...
FeroxFoxxo's user avatar
0 votes
1 answer
683 views

I am trying to make a source generator for mapping columns from the google bigquery api client to class properties. I'm having trouble getting custom column names from a ColumnAttribute on the ...
halomademeapc's user avatar
0 votes
0 answers
93 views

This is actually a more general question. I am struggling to understand the conceptual model underlying Roslyn and want to find out more, but am also struggling to find resources. The specific example ...
Frank's user avatar
  • 1,110
1 vote
1 answer
3k views

I am trying to create a source generator for some automationg purpose. My target types are some classes which implement unknown interfaces. Those interfaces are decorated with a custom attribute. By ...
Shoaib Shakeel's user avatar
0 votes
1 answer
1k views

It is an asp.net website project with .net framework 4.6.2, and the C# language level is set to 6.0. While developing code in Visual Studio 2022, below code cannot be recognized. Console.WriteLine($&...
Robin Sun's user avatar
  • 1,670
10 votes
3 answers
1k views

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 [...
JakobFerdinand's user avatar
0 votes
1 answer
132 views

I have a console program that has two direct dependencies: ClosedXML v0.97 and ClosedXML.Report 0.2.4. The ClosedXML.Report dependency also depends on ClosedXML, but in a version 0.95. When I try to ...
jahav's user avatar
  • 730
0 votes
1 answer
112 views

I want to add a <T> after DeserializeObject like JsonConvert.DeserializeObject<T>(json) Below is how I'm trying to achieve it var desiToken = node.DescendantTokens().Where(x => x.Text ==...
S G T's user avatar
  • 1
0 votes
1 answer
2k views

I am not able to configure the StyleCop Analyzers (Roslyn) in Rider. I saw this answered question already, but I cannot find Code Analysis in my project properties. I also tried Inspections and ...
Zumpel's user avatar
  • 319
0 votes
0 answers
130 views

I use ISourceGenerator to generate some source. On my pc all work well. But on build machine output dll doesn't contain generated sources. Should i install anything else besides net 6 sdk on build ...
Iskander Sitdikov's user avatar
6 votes
1 answer
3k views

In my blazor project, I get hundreds of RZ10012 warnings: Found markup element with unexpected name 'Foo'. If this is intended to be a component, add a @using directive for its namespace.(RZ10012) ...
lonix's user avatar
  • 22.4k
0 votes
1 answer
453 views

Roslyn analyzers and source generators Expected Actual Unity 2021.3.11f1 / Rider 2022.2.3 Analyzers: ErrorProne.NET.CoreAnalyzers Only logging Assets\Subfolder\RethrowError's error. When I remove the ...
Enescan BEKTAŞ's user avatar
0 votes
0 answers
54 views

When my project is missing some dependencies, roslyn is unable to read the semantic model of these APIs. For example: uninstalling the newtonsoft.json dependency, when parsing the var json = ...
Smartisana's user avatar
2 votes
1 answer
746 views

I am writing a Roslyn Analyzer project for .net6.0 and migrating this from a .netstandard2.0 project of the same purpose. It seems the latest Microsoft.CodeAnalysis NuGet dependency (a requirement for ...
Cyassin's user avatar
  • 1,500
0 votes
1 answer
75 views

Background We are looking to permit 3rd parties to upload compiled .NET.Core assemblies as plugins into custom AssemblyLoadContexts. Objective But the assembly needs the for security issues first, and ...
Sky's user avatar
  • 65
5 votes
0 answers
2k views

I'm in the process of updating a library in a larger solution. For this purpose, I have removed the old references in all projects and added new ones. If I compile the solution now I get about 3000 ...
ringhat's user avatar
  • 63
0 votes
1 answer
281 views

i am currently using the Syntax API from Roslyn to generate some C# code and i am wondering about a small thing when defining a set accessor like this: var setAccessor = AccessorDeclaration(SyntaxKind....
sasquatch's user avatar

1
3 4
5
6 7
59