csharp-source-generator Questions

3

Solved

Is there a way to find out whether class is partial inside Roslyn analyzer? There is a PartialImplementationPart in IMethodSymbol, but nothing similar for INamedTypeSymbol. I'm writing a Source Gen...

1

I have a generic class like this: public class Property<TObjectType> { } I would like to use the new System.Text.Json source generator but it does not seem to work for a generic class. Here ...
Annabellannabella asked 23/1, 2022 at 19:12

3

Solved

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...
Sakmar asked 3/5, 2022 at 5:40

1

I'm working on a project utilizing C# 9's Source Generator, but when the code is generated, I'm wanting different files of generated code to be emitted to specific file paths/locations within the e...

1

Solved

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...

0

Given a working source generator and a working test project for the generator. Generator <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandar...
Pelagia asked 11/2, 2022 at 11:2

2

Edit3: At some point this just started working. No clue why. Maybe it was a VS bug that got fixed? Edit2: Looking into the Analyzers node in solution explorer, I've discovered the source generator ...

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

1

Solved

Is there any standard method/option, how to arrange the files generated via Source Generators and added to the build process are also physically visible in the project structure (so developer can r...
Fulgurous asked 9/7, 2021 at 14:45

1

I am trying to run C# source generators in-memory using the following code snippet: var syntaxTree = await SyntaxTreeFromRelativeFile("testdata/IMyInterface.cs"); var compilation = CSharp...
Duffel asked 2/7, 2021 at 21:18

1

Solved

I want to generate a static class that should have a method depending on other classes in specific reference assembly. a simplified example: // Generator.csproj [Generator] public class MyGenerato...
Judicature asked 20/6, 2021 at 11:9
1

© 2022 - 2024 — McMap. All rights reserved.