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

I have a VS extension with a custom "Code Map" tool window. It displays specific code elements in a tree view control. The tree view nodes support navigation to symbol definition on a double ...
SENya's user avatar
  • 1,492
0 votes
0 answers
21 views

I've got an application that has hundreds of plugins available as Nuget packages in a private repo. The application's "Plugin Search" feature relies (in part) on embedding some metadata ...
daveharnett's user avatar
1 vote
1 answer
77 views

I am writing a Roslyn analyzer for visual studio 2022. I need to add a tool menu button for some extra functionality. However, I seem to not be able to link up those two projects. When I run the ...
Arınç Demir's user avatar
1 vote
0 answers
46 views

I'm migrating several projects from .NET Framework to .NET Standard 2.0. As part of this migration, I need to ensure that all project references assemblies that are compatible with .NET Standard. ...
tananas's user avatar
  • 73
0 votes
2 answers
74 views

I have a .NET 8 project I'm trying to build. I get so many errors. For example, Now, in the editor, this "error" is set to "suggestion." Here's my Code Style settings. And ...
noobie's user avatar
  • 670
0 votes
1 answer
145 views

I created a simple source generator that works fine using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Text; ...
Luiz Bicalho's user avatar
2 votes
1 answer
122 views

I'm writing a source generator that processes my model classes and adds some custom serialisation code for them. The model classes can have all sorts of property types. I'm currently interested in the ...
ygoe's user avatar
  • 20.7k
0 votes
1 answer
84 views

On C# you can get some information about the caller of a method via the [Caller*] attributes. You can get the member name, file path and line number of the caller. But what happens when the method is ...
Peluko's user avatar
  • 55
3 votes
1 answer
331 views

I am trying to ban the usage of Newtonsoft.Json package in my codebase, and I am trying to use the BannedApiAnalyzers Nuget package (latest stable version, 3.3.4). My problem is that while I am able ...
Gil's user avatar
  • 179
0 votes
0 answers
108 views

I'm in a situation where there are many generated types from different domains/projects/systems, but there's a lot of overlap between them. In the past I've used things like Automapper to provide some ...
mjg's user avatar
  • 191
0 votes
1 answer
754 views

I have a solution which contains 4 projects. One of them is a Roslyn source generator, one is a class library which uses the source generator, one is a testing project which also uses the source ...
kinderhead's user avatar
0 votes
0 answers
105 views

The goal is to create a simple test application that enables the loading of a script and accesses a predefined static class and outputs a value from this class to the console. Version Used: 4.10.0-3....
3HMonkey's user avatar
  • 137
1 vote
1 answer
219 views

I'm trying to analyse the primary constructor of a class but I can't find how. It should be possible to find it in the syntax tree, I don't want to create the semantic model. The code is pretty ...
Miroslav's user avatar
  • 4,742
-1 votes
1 answer
83 views

I have a problem generating C# code dynamically when the calling process is a native Win32 C++ application. To narrow down the problem, I have created the following test projects: DynCodeDll: .net5 ...
suriel's user avatar
  • 341
1 vote
1 answer
155 views

I try to use the Roslyn-compiler to compile some sourcecode at runtime. To do so I did public static void compile() { SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(code); } Of course this ...
suriel's user avatar
  • 341
1 vote
1 answer
570 views

In order to execute some logic with a source generator on some files (image files more precisely) based on the folders structure of the targeted/referencing project, I need to get the path/directory ...
Cfun's user avatar
  • 9,871
-1 votes
1 answer
275 views

I am developing a system that uses Roslyn to do runtime compilation of C# code. I am adding assemblies using this code, passing the fully qualified assembly file name to the method. public bool ...
Andy L's user avatar
  • 11
0 votes
1 answer
995 views

So I have this NET6.0 console application that acts as a sort of bridge between other apps for UDP messages. To define how to send data out of my application have this profile system that consists in ...
MrBott_a's user avatar
0 votes
0 answers
139 views

I have an attribute I'm generating that contains a couple of constructor arguments, a string and a Type, and I'd really like to get the namespace of the Type, because I need to include that in the ...
Stuart Grassie's user avatar
1 vote
1 answer
82 views

Why does testB in this example not give a "warning CS0184: The given expression is never of the provided ('MyClass2') type" the same way that testA does? class Program { void Main() {...
innominate227's user avatar
3 votes
1 answer
649 views

I am trying to use Roslyn to compile C# code at runtime. My compilation function is as follows: using System.Collections.Immutable; using Basic.Reference.Assemblies; using Microsoft.CodeAnalysis; ...
D.J. Elkind's user avatar
0 votes
0 answers
61 views

I wanted to know if it exists an equivalent of Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree for razor or cshtml documents. My goal is to generate razor document dynamically, and I don't want to do ...
frank_lbt's user avatar
  • 506
0 votes
1 answer
160 views

I'm writing a program that needs to analyze C# code and figure out, for each method invocation, exactly what method of what class is being called. The appropriate tools for this job would seem to be ...
rwallace's user avatar
  • 34.1k
0 votes
1 answer
907 views

I have a set of projects that successfully compile and build on Visual Studio 2022. I'd like to build them programmatically. For this purpose, I created a builder project, that makes use of Microsoft....
Starnuto di topo's user avatar
1 vote
1 answer
252 views

I'm trying to build my first source generator, the source generator is designed to register hangfire recurring jobs and a basic version is working similar to the. You can see this on the master branch ...
IeuanW's user avatar
  • 298

1
2
3 4 5
59