Questions tagged [compiler-services]

Compiler services is derived from the compiler source code that exposes additional functionality for implementing language bindings, additional tools based on the compiler or refactoring tools. It can also include interactive service that can be used for embedding scripting into your applications.

Compiler services is derived from the compiler source code that exposes additional functionality for implementing language bindings, additional tools based on the compiler or refactoring tools. It can also include interactive service that can be used for embedding scripting into your applications.

21 questions
6
votes
1 answer

MethodBase.GetCurrentMethod().Name vs [CallerMemberName]

What are the differences and the impact on the code? What about performance and limitations, what would make a better fit? The new attributes: - [CallerFilePathAttribute] - [CallerMemberName] - [CallerLineNumber] Today they are also available in…
J. Lennon
  • 3,311
  • 4
  • 33
  • 64
4
votes
3 answers

Why cant we use IteratorStateMachineAttribute in C#?

I did a Go To Definition (F12) on a class I was trying to derive from and I noticed that one of the methods was marked with AsyncStateMachineAttribute. Which in turn inherits StateMachineAttribute. I was curious and decide to read up on this…
Eniola
  • 710
  • 1
  • 7
  • 23
2
votes
2 answers

Decompiling leads to error CS1112, assembly confusion

So I ran a C# university program through de4dot and then reflector to decompile it and the following error appeared when I ran it in VS. [assembly: System.Runtime.CompilerServices.Extension] Error CS1112 Do not…
1
vote
1 answer

VS2017 crashes with 'FileNotFoundEx: System.Runtime.CompilerServices.Unsafe, V=4.0.4.1' upon loading any project

Sorry for a lengthy one, but I'm in dire straits - just trying to provide all details upfront. This Fri (2021-Nov-12) after a restart of Visual Studio 2017 it began crashing without notice while opening existing solutions. This worked perfectly fine…
1
vote
2 answers

How can I tell which defines are missing in a C file, not via compilation failure?

I have a C file (for simplicity, assume it includes nothing). This C files requires several definitions of literal numbers to compile properly - and I want to figure out which definitions these are. Naturally, one can try to compile the file, and at…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
1
vote
0 answers

FSharp Compiler Service: how to determine mutual recursion on module-level declarations from Typed AST?

I'm currently making an application that analyses the typed AST of an FSharp program using FSharp Compiler Service. I'm running into issues when it comes to identifying mutually recursive functions on module level declarations. The TAST patterns…
1
vote
1 answer

error MSB4086: A numeric comparison was attempted on "$(MSBuildVersion)" that evaluates to "" instead of a number

Trying to deploy the project with Azure Kudu (reading from a BitBucket repo) I get the following error in Deployment Center within Azure Portal... This error happened with all the latest versions of Microsoft.Net.Compilers NuGet package. The only…
Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480
1
vote
1 answer

How to run a method after a diagnostic has analyzed a compilation completely?

I am implementing DiagnosticAnalyzer for analyzing a CompilationWithAnalyzers object using the roslyn compiler library. I wish to add an event at the exhaustion of a single diangosticanalyzer, but have been unable to find such a hook. The only…
Samuel Jenks
  • 1,137
  • 4
  • 21
  • 34
1
vote
0 answers

What is the difference between Declare and System.Runtime.InteropServices.DllImportAttribute?

I'm using VB.NET and obtain an icon from a System-DLL. Therefore, I use ExtractIconEx. As mentioned in the remarks, I'm using DestroyIcon to free the resources again. So far, I used the line Private Declare Auto Function DestroyIcon Lib…
LWChris
  • 3,320
  • 1
  • 22
  • 39
1
vote
1 answer

What possible value (or danger) might this usage, non-usage, or abusage of System.Runtime.CompilerServices be?

In the legacy spaghetti, I came across this spicy meatball: //Keep around, might prove useful. namespace System.Runtime.CompilerServices { public sealed class IsVolatile { private IsVolatile() { } } } Is this…
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
1
vote
2 answers

tsc --module always generates the same output no matter the argument

I'm pretty new to Javascript, NodeJS and --obviously-- TypeScript. I'd like to experiment with the compiler services in src/services (Windows) to provide intellisense, etc. for an editor. As far as I can tell, I need to be able to require the…
guillermooo
  • 7,915
  • 15
  • 55
  • 58
0
votes
0 answers

How to get property type in property attribute in C#?

I am declaring the custom attribute that accept its property type. For example, let my attribute name as MyCustomAttribute, then public class MyCustomAttribute : Attribute { public Type PropertyType { get; } public MyCustomAttribute(Type…
gk2
  • 67
  • 4
0
votes
1 answer

Does ConditionalWeakTable guarantee insertion order?

As the title already says, is insertion order guaranteed by ConditionalWeakTable? Couldn't find any answers for this on the internet, and it doesn't inherit any other collection class from which it could copy the behavior, so no luck…
0
votes
1 answer

Is there a smart way to duplicate a Stack(Of ...)

In vb.net, I'm trying to create an extension to duplicate/reverse/merge stacks. Please note that it might exists already but I'm facing an issue. I've a module, called utility.vb that hold a whole bunch of like the Duplicate that I'm…
Skippy
  • 19
  • 5
0
votes
2 answers

Visual Studio - inject hard coded number / identifier in to code

Is something along these lines possible? Using Visual Studio (and it's kind of language agnostic I guess but I am using C#), precompiling, I would like to somehow inject and replace values with a unique ID (or number is fine!). E.g. public void…
PKCS12
  • 407
  • 15
  • 41
1
2