Questions tagged [clr]

The Common Language Runtime (CLR) is a core component of Microsoft's .NET initiative. It is Microsoft's implementation of the Common Language Infrastructure (CLI) standard, which defines an execution environment for program code. In the CLR, code is expressed in a form of bytecode called the Common Intermediate Language (CIL, previously known as MSIL—Microsoft Intermediate Language).

Developers using the CLR write code in a language such as C# or VB.NET. At compile time, a .NET compiler converts such code into CIL code. At runtime, the CLR's just-in-time compiler converts the CIL code into code native to the operating system. Alternatively, the CIL code can be compiled to native code in a separate step prior to runtime by using the Native Image Generator (NGEN). This speeds up all later runs of the software as the CIL-to-native compilation is no longer necessary.

Although some other implementations of the Common Language Infrastructure run on non-Windows operating systems, Microsoft's .NET Framework implementation runs only on Microsoft Windows operating systems.

Books

Articles

3930 questions
117
votes
6 answers

No AppDomains in .NET Core! Why?

Is there a strong reason why Microsoft chose not to support AppDomains in .NET Core? AppDomains are particularly useful when building long running server apps, where we may want to update the assemblies loaded by the server is a graceful manner,…
Aditya Pasumarthi
  • 1,219
  • 2
  • 9
  • 3
99
votes
6 answers

SQL Server: How to check if CLR is enabled?

SQL Server 2008 - What is an easy way to check if clr is enabled?
magnattic
  • 12,638
  • 13
  • 62
  • 115
98
votes
9 answers

Implementing C# for the JVM

Is anyone attempting to implement C# for the JVM? As a Java developer, I've been eyeing C# with envy, but am unwilling to give up the portability and maturity of the JVM, not to mention the diverse range of tools for it. I know there are some…
Rob
  • 5,512
  • 10
  • 41
  • 45
98
votes
4 answers

Float vs Double Performance

I did some timing tests and also read some articles like this one (last comment), and it looks like in Release build, float and double values take the same amount of processing time. How is this possible? When float is less precise and smaller…
Joan Venge
  • 315,713
  • 212
  • 479
  • 689
94
votes
6 answers

How do ValueTypes derive from Object (ReferenceType) and still be ValueTypes?

C# doesn't allow structs to derive from classes, but all ValueTypes derive from Object. Where is this distinction made? How does the CLR handle this?
Joan Venge
  • 315,713
  • 212
  • 479
  • 689
89
votes
4 answers

ASP.NET CLR Not Enabled

I am getting the following error on my new installation of ASP.Net and SQL Server when I run my app: Execution of user code in the .NET Framework is disabled. Enable "clr enabled" configuration option I have tried to fix it by running this: use…
cdub
  • 24,555
  • 57
  • 174
  • 303
84
votes
2 answers

Deciphering the .NET clr20r3 exception parameters P1..P10

I'm trying to decipher the meaning on the P1...P10 parameters associated with a clr20r3 that is written to the event log when my application experiences an exception. The best I've been able to find is: P1: the hosting process (e.g. w3wp.exe) P2:…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
82
votes
8 answers

Should we always include a default constructor in the class?

I have been asked this question by a colleague that should we always include a default constructor in a class? If so, why? If no, why not? Example public class Foo { Foo() { } Foo(int x, int y) { ... } } I am also interested…
Moon
  • 33,439
  • 20
  • 81
  • 132
79
votes
4 answers

Is there a way to get the string representation of HRESULT value using win API?

Is there a function in win API which can be used to extract the string representation of HRESULT value? The problem is that not all return values are documented in MSDN, for example ExecuteInDefaultAppDomain() function is not documented to return…
khkarens
  • 1,305
  • 1
  • 11
  • 16
77
votes
6 answers

How do I decide whether to use ATL, MFC, Win32 or CLR for a new C++ project?

I'm just starting my first C++ project. I'm using Visual Studio 2008. It's a single-form Windows application that accesses a couple of databases and initiates a WebSphere MQ transaction. I basically understand the differences among ATL, MFC, Win32…
John M Gant
  • 18,970
  • 18
  • 64
  • 82
77
votes
2 answers

What is the maximum number of parameters that a C# method can be defined as taking?

I am trying to figure out what the maximum number of parameters a method in C# can have. I've checked everywhere for an answer, including the C# official documentation, MSDN, and a couple of CLR references and I can't find an answer. Does anyone…
rmiesen
  • 2,470
  • 1
  • 21
  • 15
76
votes
13 answers

Why C# is not allowing non-member functions like C++

C# will not allow to write non-member functions and every method should be part of a class. I was thinking this as a restriction in all CLI languages. But I was wrong and I found that C++/CLI supports non-member functions. When it is compiled,…
Navaneeth K N
  • 15,295
  • 38
  • 126
  • 184
74
votes
3 answers

Size of VARBINARY field in SQL Server 2005

I am trying to determine the size in bytes of the contents in a VARBINARY(MAX) field in SQL Server 2005, using SQL. As I doubt there is native support for this, could it be done using CLR integration? Any ideas would be greatly appreciated.
Tewr
  • 3,713
  • 1
  • 29
  • 43
74
votes
8 answers

Create empty C# event handlers automatically

It is not possible to fire an event in C# that has no handlers attached to it. So before each call it is necessary to check if the event is null. if ( MyEvent != null ) { MyEvent( param1, param2 ); } I would like to keep my code as clean as…
Tomas Andrle
  • 13,132
  • 15
  • 75
  • 92
74
votes
6 answers

Why check this != null?

Occasionally I like to spend some time looking at the .NET code just to see how things are implemented behind the scenes. I stumbled upon this gem while looking at the String.Equals method via…
Brian Gideon
  • 47,849
  • 13
  • 107
  • 150