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
2
votes
0 answers

CLR version issues with Newtonsoft.Json

I have a C# solution that utilizes Microsoft Graph v3.31.0. This library is added to the C# project via nuget and has a dependency to Newtonsoft.Json v6.0.1. Now I have a CLR solution that maps the functions from the C# solution to a C++…
2
votes
1 answer

IMetaDataEmit::DefineUserString returns HRESULT: -2147024882 (0x8007000E E_OUTOFMEMORY)

I'm playing around with the unmanaged Profiling interfaces for the CLR. When running with a netcoreapp3.1 or net5.0 console application, in ICorProfilerCallback::JITCompilationStarted or in ICorProfilerCallback::ModuleLoadFinished, any call to…
Russ Cam
  • 124,184
  • 33
  • 204
  • 266
2
votes
1 answer

Create .NET 2.0 AppDomain in .NET 4.0 process

I need to dynamically create a .NET 2.0 compatible assembly from within my .NET 4.0 process. Currently it is achieved with this: AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly(...) ModuleBuilder mb =…
Peervm
  • 482
  • 4
  • 11
2
votes
1 answer

Why doesn't the compiler (or the runtime) do the InvokeRequired pattern for me?

Why isn't cross-thread UI update safety handled automatically? To ensure thread-safety when potentially updating the UI from another thread we have to write the if (Control.InvokeRequired()) Invoke(..) pattern, or something equivalent. Could the…
Igby Largeman
  • 16,495
  • 3
  • 60
  • 86
2
votes
1 answer

what does HANDLE(RefCnt) mean in windbg?

The following is my checking gcroot of the object 0330e9a8. I found Its root is a hanle with its type is "RefCnt". How could I get the actual reference count of it. And How could I know WHICH object obtained its reference? 0:042> !GCRoot 0330e9a8…
Calvin Kwok
  • 161
  • 1
  • 9
2
votes
1 answer

Using C# DLL in Python3 with Pythonnet

I'm using c# dll in Python3, and the module I'm using is DaveSkender/Stock.Indicators It is written in C# and complies with the Common Language Specification (CLS). So I compiled it as dll and imported in Python3 like below: import…
6991httam
  • 305
  • 4
  • 14
2
votes
1 answer

Loading CLR in C++, Start() problem

So I'm trying to load up the .NET 4 runtime and run my own C# DLL. The Start() method is throwing a HRESULT=0x1 error. If I comment out the start code, the C# DLL loads and executes, then the Stop() method throws a HRESULT=0x8000ffff error. I've…
2
votes
2 answers

How does a struct instance's virtual method get located using its type object in heap?

below is a code example from a book to show when a value type will be boxed: internal struct Point { private readonly Int32 m_x, m_y; public Point(Int32 x, Int32 y) { m_x = x; m_y = y; } //Override ToString method…
user9623401
2
votes
1 answer

Current AppDomain loading assemblies outside of application base?

I'm creating a new sandbox AppDomain whose ApplicationBase and PrivateBinPath (for example sake) has been set to C:\MyApp. My executing application is running from C:\SomewhereElse. When I otherDomain.Load(...) an assembly, my executing AppDomain is…
Martin Blore
  • 2,125
  • 4
  • 22
  • 34
2
votes
1 answer

event declaration and FieldOffsetAttribute using

i have a CLR class which uses the Attribute StructLayout attribte: [StructLayout(LayoutKind::Explicit)] public ref class Matrix4 : System::ComponentModel::INotifyPropertyChanged All fields make use of the FieldOffset attribute. Now i need to add an…
apo_x
  • 75
  • 2
  • 6
2
votes
1 answer

How can I call a method outside the executing assembly in MSIL?

I have access to a function body Intermediate Language like this : byte[] ilCodes = NestedFooInfo.GetMethodBody().GetILAsByteArray(); I am able to modify its IL code so that before executing the method body I call the following method named…
Amon
  • 296
  • 1
  • 14
2
votes
2 answers

What is LogHelp_TerminateOnAssert?

There is a similar question from a decade ago, but there was no good answer - hopefully things have changed since then. I have a fairly multithreaded Winforms app based on .NET 4.72. I am looking at it with Process Explorer Threads view and it has…
AngryHacker
  • 59,598
  • 102
  • 325
  • 594
2
votes
2 answers

C# Constructors Ambiguity with explicit call - Error CS0012

There is an unexplained ambiguity in C#, where I explicitly try to call a constructor but the compiler thinks it is a different constructor. I will start with showing a short C# architecture we use. Then show a small "working" example I created, and…
Juv
  • 744
  • 7
  • 12
2
votes
2 answers

How do I access the .NET TimeZoneInfo class from SQL Server 2005?

The TimeZoneInfo class has a Host Protection Attribute of MayLeakOnAbort. This seems to prevent me accessing it from the SQL Server CLR. But is there a workaround?
user74207
  • 251
  • 2
  • 7
2
votes
2 answers

Is there a way to grant privileged access to a .NET assembly to only one other assembly?

I have a class library assembly and some test code. Because the test code needs to peek at the internals of the the class, it needs to be part of the assembly and because I don't want to have it run all by it's self, it needs have something public…
BCS
  • 75,627
  • 68
  • 187
  • 294