cil Questions
3
Solved
I'm looking for an extension for Visual Studio where in debug mode it's possible to single step through the intermediate language beside C#.
I'm not looking for a solution to debug managed and unm...
Arlindaarline asked 13/3, 2011 at 21:37
1
Solved
Having the class
class C
{
public T Get<T>()
{
return default;
}
public void M()
{
int i = this.Get<Int32>();
}
}
I want to generate the body of M at runtime using Reflectio...
Outrage asked 21/11, 2018 at 7:46
4
Solved
I am wondering whether it is possible to change a .NET console application entry point from Main to Main2 method in the example below:
class Program
{
static void Main(string[] args)
{
Consol...
2
Solved
I have this code that emits some IL instructions that calls string.IndexOf on a null object:
MethodBuilder methodBuilder = typeBuilder.DefineMethod(
"Foo",
MethodAttributes.Public,
typeof(void)...
Zalucki asked 16/9, 2018 at 0:28
5
Is it possible to insert IL code to C# method?
1
Solved
I have a Main method like this:
static void Main(string[] args)
{
var b = new byte[1024 * 1024];
Func<double> f = () =>
{
new Random().NextBytes(b);
return b.Cast<int>().Avera...
Staves asked 29/8, 2018 at 23:22
2
Solved
It is well known how to convert code from SSA representation to a register machine. (Basically, graph coloring register allocation is the core of such conversion.)
But what's the general method fo...
Ruttish asked 14/7, 2018 at 14:33
1
I was reading C# 7.0 changelog and ran into an example that shows new tuples syntax.
private static (int Max, int Min) Range(IEnumerable<int> numbers)
{
int min = int.MaxValue;
int max = i...
Disguise asked 12/7, 2018 at 5:28
1
4
Solved
The question might seem odd, but I am still trying to grasp the concepts of virtual machines. I have read several answers, but I still don't get if Java bytecode (and MSIL as well) is the same as a...
Suggs asked 22/8, 2016 at 16:0
3
Solved
I noticed that a struct wrapping a single float is significantly slower than using a float directly, with approximately half of the performance.
using System;
using System.Diagnostics;
struct Vec...
2
Solved
Sometimes I want to add more typesafety around raw doubles. One idea that comes up a lot would be adding unit information with the types. For example,
struct AngleRadians {
public readonly double...
Kakaaba asked 12/7, 2017 at 16:47
2
Solved
Given the following C# code in which the Dispose method is called in two different ways:
class Disposable : IDisposable
{
public void Dispose()
{
}
}
class Program
{
static void Main(string[]...
Churchwell asked 13/4, 2018 at 11:11
1
Solved
The methods of this class
public class NullTester
{
public bool EqualsNull<T>(T o) where T : class
{
return o == null;
}
public bool IsNull<T>(T o) where T : class
{
return o i...
Obstruction asked 28/3, 2018 at 7:46
3
Solved
Using ildasm and a C# program e.g.
static void Main(string[] args)
{
}
gives:
.method private hidebysig static void Main(string[] args) cil managed
{
.entrypoint
// Code size 2 (0x2)
.maxst...
Crapshooter asked 17/3, 2009 at 22:47
2
Solved
So, a pattern I use very often while working on my UWP app is to use a SemaphoreSlim instance to avoid race conditions (I prefer not to use lock as it needs an additional target object, and it does...
Bland asked 2/3, 2018 at 19:33
1
Solved
I'm writing a library that requires a later type build. Library uses platform .Net core 2.0
There is issue with some type that I am generating using Reflection.Emit
public class GeneratedA : A, I...
Impasse asked 24/2, 2018 at 17:28
3
Solved
I've been digging into IL recently, and I noticed some odd behavior of the C# compiler. The following method is a very simple and verifiable application, it will immediately exit with exit code 1:
...
1
I have run into this issue when verifying some code containing an unsafe method that returns a pointer.
The example can be expressed as this:
public class A
{
public static unsafe int* GetAnswer()...
1
Solved
This is a question related to this fascinating question about detecting divide by zero exceptions at compile time.
From Eric Lippert's answer, this is non-trivial to achieve properly (which I supp...
1
Solved
I'm rewriting some of my extension methods using the new Span<T> type and I'm having trouble finding a way to properly pin a generic instance to be able to use parallel code to work on it.
A...
1
Solved
Before the actual question, a small disclaimer:
This is a related/follow up question to this one, but since here I'm talking about a more general issue (how to pin a ref T variable to be able to...
Memento asked 4/1, 2018 at 12:16
2
Solved
I've been looking for a way to extract slices from a 2D matrix without having to actually reallocate-copy the contents, and
public static Span<float> Slice([NotNull] this float[,] m, int ro...
2
Solved
I wrote an Int128 type and it works great. I thought I could improve on its performance with a simple idea: Improve the shift operations which are a bit clumsy.
Because they are heavily used in mu...
1
Solved
First of all, a small disclaimer before the actual question:
I know there are a lot of closed/duplicate questions regarding the difference between the sizeof operator and the Marshal.SizeOf<T&g...
Descartes asked 21/12, 2017 at 10:9
© 2022 - 2024 — McMap. All rights reserved.