clr

ILASM does not set FileVersion

 ̄綄美尐妖づ 提交于 2019-12-22 05:24:25
问题 I have an .il file which I can compile without any problems. I can strong name it and so without any issues. But I am not able to set the file version via the attribute as I would expect it. How can I set the FileVersion for an assembly when using ilasm? If I do a round trip I get always a .res file which does contain only binary data which is not readable. What is inside this res file and can I edit it? The code does not work .assembly myAssembly { .custom instance void [mscorlib]System

Static methods vs instance methods in C#

我是研究僧i 提交于 2019-12-22 05:23:26
问题 For an application I am writing, I want to have extreme extensibility and extension methods seem to give me what I want, plus the ability to call them without an instance, which I need too. I remember reading that static methods are faster than instance methods but don't get the advantages of GC. Is this correct? It's highly unlikely I will change my design unless I find a superior alternative by design not speed. But still for extra information I wanna know the differences in speed, GC, etc.

What does Array.Clear actually do under the covers?

本小妞迷上赌 提交于 2019-12-22 04:44:16
问题 I'm looking for a answer to what the Array.Clear(...) method does under the covers in C#. I've looked at the IL, but that isn't really yielding any clues, since it simply calls the System.Array::Clear(...) method in mscorlib, which then calls an unmanaged portion of the CLR that I can't observe. The reason why I am asking this, is that I am occasionally getting an SEHException thrown by my call to Array.Clear, and I can't seem to figure out why it is happening. Unfortunately, Microsoft seems

Why was an interface for arithmetic operations abandon in .NET? [closed]

若如初见. 提交于 2019-12-22 04:18:17
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . In .NET it is not possible to constrain a generic method so it only accepts numeric types as described in the following question: Is there a constraint that restricts my generic method to numeric types?. But if you look at the reference source for .NET (http://sourceof.net)

Thread.sleep vs Monitor.Wait vs RegisteredWaitHandle?

自古美人都是妖i 提交于 2019-12-22 04:02:03
问题 (the following items has different goals , but im interesting knowing how they "PAUSEd") questions Thread.sleep - Does it impact performance on a system ?does it tie up a thread with its wait ? what about Monitor.Wait ? what is the difference in the way they "wait"? do they tie up a thread with their wait ? what about RegisteredWaitHandle ? This method accepts a delegate that is executed when a wait handle is signaled. While it’s waiting, it doesn’t tie up a thread. so some thread are paused

Visual Studio 2010: Embed Interop Types

时光毁灭记忆、已成空白 提交于 2019-12-22 03:50:11
问题 I found some information about this on Scott Hanselmans Blog Does anybody exactly know what this mean? Is this only for the Office Primary Interop Assemblies, or can I also use this to Embed my Redemption library or other COM libraries? 回答1: The process described in Scott Hanselman's blog is called Type Equivalence , a rather nebulous term for the CLR 4.0's support for COM interop type assemblies. Although I haven't had a chance to look at it, there is a video here at Channel 9 that discusses

call instead of callvirt in case of the new c# 6 “?” null check

微笑、不失礼 提交于 2019-12-22 03:16:07
问题 Given the two methods: static void M1(Person p) { if (p != null) { var p1 = p.Name; } } static void M2(Person p) { var p1 = p?.Name; } Why the M1 IL code use callvirt : IL_0007: brfalse.s IL_0012 IL_0009: nop IL_000a: ldarg.0 IL_000b: callvirt instance string ConsoleApplication4.Person::get_Name() and the M2 IL use call : brtrue.s IL_0007 IL_0004: ldnull IL_0005: br.s IL_000d IL_0007: ldarg.0 IL_0008: call instance string ConsoleApplication4.Person::get_Name() I just can guess that it because

call instead of callvirt in case of the new c# 6 “?” null check

孤人 提交于 2019-12-22 03:16:01
问题 Given the two methods: static void M1(Person p) { if (p != null) { var p1 = p.Name; } } static void M2(Person p) { var p1 = p?.Name; } Why the M1 IL code use callvirt : IL_0007: brfalse.s IL_0012 IL_0009: nop IL_000a: ldarg.0 IL_000b: callvirt instance string ConsoleApplication4.Person::get_Name() and the M2 IL use call : brtrue.s IL_0007 IL_0004: ldnull IL_0005: br.s IL_000d IL_0007: ldarg.0 IL_0008: call instance string ConsoleApplication4.Person::get_Name() I just can guess that it because

.NET 4.5: internal error in the .NET Runtime (80131506) / disabling concurrent GC

一世执手 提交于 2019-12-22 01:33:25
问题 I have a long-running .NET 4.5 application that crashes randomly, leaving the message I've mentioned in the question title in the event log. The issue is reproduced on 3 different machines and 2 different systems (2008 R2 and 2012). Application doesn't use any unsafe/unmanaged components, it's pure managed .NET, with the only unmanaged thing being the CLR itself. Here's the stack trace of the crash site that I've extracted from the dump: clr.dll!MethodTable::GetCanonicalMethodTable() clr.dll

What are the benefits of using Scala in .Net?

会有一股神秘感。 提交于 2019-12-22 01:28:21
问题 Scala is a peculiar programming language in that it targets both JVM and the CLR. But what are the benefits? Is it worth considering it as a viable alternative to the F# language? 回答1: Most of the web search hits I see from "Scala .NET" are from 2008 or early 2009. Scala is an interesting language, but my admittedly-ill-informed impression is that is is not a "viable alternative" for an industrial-strength .NET application. I see people talk in passing about writing apps that are portable