Skip to main content
Filter by
Sorted by
Tagged with
1355 votes
61 answers
889k views

I am trying to run an ASP.NET MVC (model-view-controller) project retrieved from TFS (Team Foundation Server) source control. I have added all assembly references and I am able to build and compile ...
Eyad's user avatar
  • 14.4k
217 votes
5 answers
85k views

In Visual Studio 2015 or later, I can open the 'C# interactive window', and run code: > 5 + 3 8 That's cute. Now how can I interact my code—my classes? Assume I have a project open. > new Cog()...
Colonel Panic's user avatar
140 votes
2 answers
25k views

In C# 6, you can use the nameof() operator to get a string containing the name of a variable or a type. Is this evaluated at compile-time, or at runtime via some Roslyn API?
Gigi's user avatar
  • 29.7k
136 votes
5 answers
52k views

I was writing a unit test on a piece of code that returned JSON. The type that it returns is an anonymous type, so I thought to verify the values on it I'd just cast the object to a dynamic to do my ...
DLeh's user avatar
  • 24.6k
122 votes
5 answers
38k views

From a press release yesterday on InfoWorld regarding the new Microsoft Roslyn: The most obvious advantage of this kind of "deconstructed" compiler is that it allows the entire compile-execute ...
mellamokb's user avatar
  • 56.8k
100 votes
5 answers
29k views

I modified the example that comes with the new version of Roslyn that was released yesterday to use dynamic and ExpandoObject but I am getting a compiler error which I am not sure how to fix. The ...
Rush Frisby's user avatar
  • 11.5k
95 votes
4 answers
8k views

After I have migrated my project from VS2013 to VS2015 the project no longer builds. A compilation error occurs in the following LINQ statement: static void Main(string[] args) { decimal a, b; ...
ramil89's user avatar
  • 851
92 votes
5 answers
72k views

There are a bunch of related questions on this, though most of the answers define Roslyn and/or provide a "fix" to some issue (exe, with hosting providers, etc.) What I can't seem to track ...
EdSF's user avatar
  • 12.5k
76 votes
6 answers
33k views

I am facing a strange issue from roslyn compiler. Sometimes when I build the solution I face a strange issue in error list which does not let me build the solution. Here is the error: Severity ...
Rey's user avatar
  • 4,086
73 votes
1 answer
5k views

I'm building a set of code diagnostics using Roslyn (in VS2015 Preview). Ideally, I'd like any errors they produce to act as persistent errors, just as if I were violating a normal language rule. ...
Jon Skeet's user avatar
  • 1.5m
67 votes
2 answers
13k views

Now that we have enum constraint, why doesn't compiler allow me to write this code? public static TResult? ToEnum<TResult>(this String value, TResult? defaultValue) where TResult : Enum { ...
Kyrylo Kovalenko's user avatar
61 votes
2 answers
18k views

String interpolation in C#6 lets me write: decimal m = 42.0m; string x = $"The value is {m}"; However, a very common use case for string formatting is to specify the locale used for formatting the ...
driis's user avatar
  • 165k
60 votes
1 answer
2k views

For some reason, even so much as typing this into a C# file in Visual Studio is enough to cause it to instantly crash. Why? unsafe struct node { node*[] child; } It seems to occur when the IDE ...
Orion's user avatar
  • 1,236
55 votes
9 answers
73k views

I'm trying to work with a large opensource project that has a handful of Roslyn Code Analyzers. When I open the solution Visual Studio uses ~35% CPU for about 15 minutes. Using PerfView I've figured ...
JoshVarty's user avatar
  • 9,496
52 votes
2 answers
103k views

Having read this question on HNQ, I went on to read about Nullable Reference Types in C# 8, and made some experiments. I'm very aware that 9 times out of 10, or even more often, when someone says "I ...
Andrew Savinykh's user avatar
50 votes
3 answers
6k views

Using Roslyn, I would like to modify my C# code before the actual compilation. For now, I will just need something like: [MyAnotatedMethod] public void MyMethod() { // method-body } And based ...
Lukas Durovsky's user avatar
47 votes
2 answers
35k views

I read that you can't compile C# 6.0 with CSharpCodeProvider and therefor trying to do with with Roslyn. But I can't find a good example how to load a file and then compile it to a dll. How should I ...
MilleB's user avatar
  • 1,630
44 votes
3 answers
15k views

I'm trying to use a dynamic variable in a C# .net core app that's targeting .net standard 1.6. (platform? library? framework? meta-framework?) I first encountered this problem in a real application, ...
recursive's user avatar
  • 86.5k
42 votes
5 answers
10k views

Was C# compiler written in C++?
Joan Venge's user avatar
  • 334k
40 votes
1 answer
17k views

Recently I started reading about .NET reorganization details (mostly through .NET Core GitHub pages). It seems that they created sibling projects to support more platforms. While reading I have the ...
Robert Zaremba's user avatar
38 votes
1 answer
8k views

The ObjectPool is a type used in the Roslyn C# compiler to reuse frequently used objects which would normally get new'ed up and garbage collected very often. This reduces the amount and size of ...
Muhammad Rehan Saeed's user avatar
36 votes
3 answers
5k views

I've been looking at Visual Studio 14 CTP along with C# 6.0 and playing with the null-propagation operator. However, I couldn't find why the following code does not compile. The features are not yet ...
nan's user avatar
  • 20.4k
33 votes
3 answers
11k views

I'm working on a project where we are using Roslyn to compile some templates for us. Now when I'm compiling the template I'm receiving multiple errors in the CompileResult.Diagnostics. The errors are:...
Jan_V's user avatar
  • 4,446
32 votes
5 answers
24k views

When I needed to generate some C# code, for example DTO classes from xsd schema, or an excel table, I've used some roslyn API's. Is there something simmilar for typescript? [EDIT]: I've end up using ...
Liero's user avatar
  • 27.8k
31 votes
2 answers
4k views

Given the following code: public class C { public void M() { var x = 5; Action<int> action = y => Console.WriteLine(y); } } Using VS2013, .NET 4.5. When looking ...
Yuval Itzchakov's user avatar

1
2 3 4 5
59