clr

How to understand these paragraphs in EMCA 335 regarding `.locals init`?

半世苍凉 提交于 2019-12-01 13:32:54
From ECMA 335 I.12.4.1 Method calls The local variable array always has null for object types and for fields within value types that hold objects. In addition, if .locals init is set, then the local variable array is initialized to 0 for integral types and 0.0 for floating point types. Value types are not initialized by CLI, but verified code will supply a call to an initializer as part of the method's entry point code. So Does "initialized to 0 for integral types and 0.0 for floating point types" mean "zeroes the value types"? Does it mean: regardless of .locals init , CLI must always ensure

How to understand these paragraphs in EMCA 335 regarding `.locals init`?

删除回忆录丶 提交于 2019-12-01 12:23:04
问题 From ECMA 335 I.12.4.1 Method calls The local variable array always has null for object types and for fields within value types that hold objects. In addition, if .locals init is set, then the local variable array is initialized to 0 for integral types and 0.0 for floating point types. Value types are not initialized by CLI, but verified code will supply a call to an initializer as part of the method's entry point code. So Does "initialized to 0 for integral types and 0.0 for floating point

Invoking CLR stored procedures

岁酱吖の 提交于 2019-12-01 11:47:26
问题 In short, where can I find C#/VB client side sample code that calls CLR stored procedure with some argumnet [like a sqlxml data] and receives a datareader or other form of result ? Also how do I periodically receive information from the running CLR stored proc sent through SQlContext.Pipe.Send() method ? 回答1: // run a stored procedure that takes a parameter public void RunStoredProcParams() { SqlConnection conn = null; SqlDataReader rdr = null; // typically obtained from user // input, but we

Why does CLR create new class for anonymous method?

≯℡__Kan透↙ 提交于 2019-12-01 11:46:45
I am using anonymous functions in my projects no less. And till know I was thinking that, C# compiler generates just a method using the code used for the anonymous method in the same class . But, after decompiling this code in IL, I saw that CLR created a new class. public class Comparer { public delegate int Greater(int a, int b); public int Great(Greater greater, int a, int b) { return greater(a, b); } } static void Main(string[] args) { int valueOfA = 11, valueOfB = 23, valueOfC = 42; Comparer comparer = new Comparer(); Console.WriteLine("The greater is \t:{0}", comparer.Great(delegate(int

Investigation of CLR via SOS

喜夏-厌秋 提交于 2019-12-01 11:15:42
Currently I am digging deeper into CLR and try to find proper size of my managed objects. I have two simple types: XClass class XClass { public XStruct StructField = new XStruct(); public int IntField; public double DoubleField; } and XStruct struct XStruct { public short ShortField; public long LongField; } Also cosider code snippet where this objects are involved: static unsafe void Main(string[] args) { double angle = 0.34; { double anotherDouble = 1.49; XStruct xStruct = new XStruct(); xStruct.ShortField = 12; xStruct.LongField = 1234567890; XClass classObject = new XClass(); classObject

Configure .NET CLR RAM usage

对着背影说爱祢 提交于 2019-12-01 10:34:59
Is there a method of configuring the .NET CLR RAM usage on my machine? Suppose I have 64GB of RAM and I want to limit it to 4GB? It this possible? Edit - The root of the problem is that I have a 64-bit application that runs fine on a 64bit - 4GB machine but when run on a 64bit - 64GB machine it fails (stops dead in it's tracks when allocating memory). I'm thinking memory fragmentation is the cause as the application attempts to allocate up to 8GB chunks if there is enough RAM available otherwise it breaks the allocations down to much smaller chunks. So I would have to configure the application

Difference between VB.Net and C# “As New WebControl”

无人久伴 提交于 2019-12-01 09:26:20
问题 I was refactoring some code, and part of it included moving it from VB.Net to C#. The old code declared a member like this: Protected viewMode As New WebControl The new code, I eventually got working, like this: protected WebControl _viewMode = new WebControl(HtmlTextWriterTag.Span); I can presume that the New keyword meant: call the constructor! But how was VB.Net calling a constructor (a parameter-less one) that I couldn't call in C#? 回答1: The reason this worked in VB, and not in C#, had

CLR/Fastcall: How are large value types passed internally to called functions?

心不动则不痛 提交于 2019-12-01 09:19:43
Just out of curiosity: value types are generally copied, and the JIT compiler seems to use Microsoft's Fastcall calling convention when calling a method. This puts the first few arguments in registers, for fast access. But how are large value types (i.e. bigger than the size of a register or the width of the stack) passed to the called function? This book excerpt states that: The CLR's jitted code uses the fastcall Windows calling convention. This permits the caller to supply the first two arguments (including this in the case of instance methods) in the machine's ECX and EDX registers. It is

Configure .NET CLR RAM usage

匆匆过客 提交于 2019-12-01 09:18:13
问题 Is there a method of configuring the .NET CLR RAM usage on my machine? Suppose I have 64GB of RAM and I want to limit it to 4GB? It this possible? Edit - The root of the problem is that I have a 64-bit application that runs fine on a 64bit - 4GB machine but when run on a 64bit - 64GB machine it fails (stops dead in it's tracks when allocating memory). I'm thinking memory fragmentation is the cause as the application attempts to allocate up to 8GB chunks if there is enough RAM available

array/object keys for hashtables in powershell

北城余情 提交于 2019-12-01 08:50:20
When creating a hash with an array key, How do i generate a key to look up the hash value. that is, without getting it from the hash's enumerator $a = @{"a" = "1" "b" = "2" ("c","c1") = "3"} Using a regular array, doesn't seem to work. $k1 = @("c","c1") $a.ContainsKey($k1) #false However, if the array object is used on creation, this seems to work. $k1 = @("c","c1") $a = @{"a" = "1" "b" = "2" $k1 = "3"} $a.ContainsKey($k1) #true if for example, i use this to generate a hashtable: $a = Get-Eventlog system -newest 100 | Group-Object {$_.EntryType, $_.Source } -AsHashTable how do i generate a