Skip to main content
Filter by
Sorted by
Tagged with
-2 votes
4 answers
141 views

I'm working on a .NET application where every command/query handler needs access to three shared services: IValidator, ISecurity and ILogger. Rather than manually injecting these into each handler ...
Mahmudul Hasan's user avatar
1 vote
1 answer
1k views

I have following Execute method in my source generator. I can get all the properties (x.Item1.Members.AsEnumerable()...) of my class. But I can't manage to get the properties of the base class too. ...
Dani's user avatar
  • 1,097
3 votes
0 answers
165 views

I would like to use a C# code generator for a polyglot notebook. (My eventual goal is to generate a strongly typed object model from a CSV or excel file I wish to analyze.) In an initial test I ...
John Melville's user avatar
1 vote
1 answer
196 views

I create my first Nuget Package of my incremental source generator. All was OK, targeting it as an analyzer in .csproj, embedded under analyzer/cs Nuget subfolders. But now I want to improve my ...
TRex's user avatar
  • 350
0 votes
0 answers
114 views

Unfortunately, I have no minimal sample of the issue, but I've pushed the repo publicly, where it should be reproducable: https://github.com/Yeah69/ContainerFeatureSampleComparison I've implemented a ...
Dima's user avatar
  • 360
2 votes
1 answer
2k views

C# Source generated files are ignored or show errors but when I copy the file out everything works. state.Text.g.cs using System.Collections.Generic; using System.Linq; #nullable enable namespace ...
Drachencheat's user avatar
0 votes
1 answer
140 views

I wrote a Roslyn source generator that visits all of my controllers' methods that have an HttpGet, HttpPut, HttpDelete or HttpPost attribute on them, and then makes classes like this, that I was ...
Taylor C. White's user avatar
3 votes
2 answers
7k views

I want to create an incremental source generator that reads a json file and creates some classes out of it. Unfortunately, when I build my solution, no files are generated. Even the debugger statement ...
Michael Tontchev's user avatar
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
1 vote
0 answers
109 views

I like the idea of resolving services in the IoC using attributes. I wanted to replace System.Reflection with source generation, so it improves startup time. The code snippet below is also on GitHub. #...
nop's user avatar
  • 6,617
2 votes
0 answers
179 views

I have a source generator which creates a warning, I know how this warning would be fixed and could apply this fix automatically if given the opportunity. https://github.com/dotnet/roslyn/blob/main/...
user3797758's user avatar
  • 1,113
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
1 answer
487 views

I have a C# source generator that can come across configuration issues in the data it reads, these are emitted as compile errors. Currently this looks something like this: DiagnosticDescriptor ...
user3797758's user avatar
  • 1,113
7 votes
1 answer
2k views

I have 3 projects Project A (Client) Project B (Server) Project C (Shared) Within Project B I have the DB connection using the entity framework as well as all the entity classes, Project A (Client) ...
Florent 's user avatar
4 votes
2 answers
719 views

In the context of a .net6 incremental source generator, what does the IncrementalValuesProvider.WithTrackingName(string name) method do? In addition how/when is it intended to be used? [Generator] ...
StefanGP88's user avatar
5 votes
1 answer
3k views

Using C# source generators, is there a way to get more information about types in referenced assemblies. To be more precise: Is there a way to find out which type implements an interface that resides ...
CodeChops's user avatar
  • 212
1 vote
0 answers
599 views

I am using Roslyn within a source generator to find certain c# method calls in a syntax tree. When found, I want to note the line and column number. This answer works for the line number but not the ...
Christopher J. Grace's user avatar
3 votes
1 answer
2k views

I need to create code by the IIncrementalGenerator in at least two projects which are referring to the same library that references the SourceCodeGenerator project. My solution, for further ...
Raymond Osterbrink's user avatar
7 votes
3 answers
9k views

I am trying to get some values from the appsettings.json. But whatever I try with the AdditionalTextsProvider doesn't work. Here is my code IncrementalValuesProvider<AdditionalText> textFiles = ...
Thomas K's user avatar
1 vote
1 answer
500 views

SyntaxValueProvider.CreateSyntaxProvider takes two Func arguments: a predicate that filters the syntax elements, and a transform that returns the interesting details from the syntax context. The ...
Kevin Krumwiede's user avatar
3 votes
1 answer
1k views

If source generator projects must target netstandard2.0 (C# 7.3), how and why do the examples in the .NET 6 incremental generator documentation use C# 9 syntax like static anonymous functions? From ...
Kevin Krumwiede's user avatar
2 votes
1 answer
646 views

I'm having trouble understanding the Roslyn documentation and fiting it with what I see when working on an Incremental Source Generator. https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/...
BodzioSamolot's user avatar
2 votes
1 answer
2k views

I'm working on a project where I want to generate cs classes based on JSON file that defines a set of exceptions. I looked into different options and trying source generator now. In my project, I want ...
Khaled Saleh's user avatar
4 votes
0 answers
2k views

Given a working source generator and a working test project for the generator. Generator <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>...
Prophet Lamb's user avatar
4 votes
2 answers
2k views

I ported my .NET 5.0 application to .NET 6.0 and now I found that the source-code generator fails. It shows the following error: Generator 'PermissionGenerator' failed to generate source. It will not ...
Ramon de Klein's user avatar