Questions tagged [clr-hosting]

CLR hosting means enabling a native process to execute managed code by using .NET runtime library dll that actually executes the managed code. Such native process said to "host" CLR, .NET Common Language Runtime, then in the hosted runtime the native process can execute any CLR assemblies.

CLR hosting means enabling a native process to execute managed code by using .NET runtime library dll that actually executes the managed code. Such native process said to "host" CLR, .NET Common Language Runtime, then in the hosted runtime the native process can execute any CLR assemblies.

Stack Overflow link: What is CLR hosting?

MSDN documentation:

So far, there are 3 different versions of CLR hosting for each major release of CLR: 4.0: https://msdn.microsoft.com/en-us/library/dd380851(VS.100).aspx

2.0: (Covers .NET 2.0/3.0/3.5):     https://msdn.microsoft.com/en-us/library/9x0wh2z3.aspx

1.1: https://msdn.microsoft.com/en-us/library/9x0wh2z3(v=vs.71).aspx

Books:

There is also a good book on this subject (but it mostly covers 2.0 hosting APIs):  "Customizing the Microsoft .NET Framework Common Language Runtime" from Steven Pratschner.

54 questions
33
votes
3 answers

What is CLR hosting?

What is CLR hosting? What is the use case for that?
Yaron Naveh
  • 23,560
  • 32
  • 103
  • 158
18
votes
1 answer

CLR hosting exception handling in a non-CLR-created thread

The issue: An unhandled exception in a thread entering the CLR from unmanaged code does not trigger the "normal" unhandled exception CLR processing. In the code below calling CSSimpleObject.GetstringLength() from C++ with "1" throws an exception in…
archgl
  • 2,632
  • 1
  • 16
  • 10
13
votes
4 answers

hosting clr and catching threading exceptions

I am trying to write an plugin system that can load managed plugins. The host should be able to unload the plugins if there are any exceptions. for my poc I have a sample code library in C# that throws an exception like this ... public static int…
np-hard
  • 5,725
  • 6
  • 52
  • 76
10
votes
2 answers

Resolving .NET assembly reference to a different name?

My project references Library1.dll and Library2.dll. Library2.dll has a dependency on Library1.dll, but it was compiled to reference it by a different name, Library1.Net40.dll. Is there an nice way tell my application to redirect all references for…
Chris Fulstow
  • 41,170
  • 10
  • 86
  • 110
9
votes
1 answer

How do I convert a .tlb file to headers and implementation files?

I'm trying to convert mscorlib.tlb. It normally used in C++ like this: #import "mscorlib.tlb" raw_interfaces_only \ high_property_prefixes("_get","_put","_putref") \ rename("ReportEvent",…
jcao219
  • 2,808
  • 3
  • 21
  • 22
8
votes
1 answer

CLR Hosting: Call a function with an arbitrary method signature?

I need to take a C++ program, load CLR and call a function in a C# library. The function I need to call takes in a COM interface as the parameter. My problem is, the CLR hosting interface only seems to let you call a method with this signature: int…
LCC
  • 1,170
  • 1
  • 17
  • 28
8
votes
2 answers

How does Excel VSTO Work?

How does Excel VSTO Work? If I create an Excel Workbook solution in Visual Studio 2005 I can then happily code away with full access to the Excel object model and even treat the Excel sheet as a design surface. When I build the solution I get a…
ng5000
  • 12,330
  • 10
  • 51
  • 64
7
votes
1 answer

Creating a hosted CLR AppDomain with full trust permissions including network rights

I need to host the .NET runtime in an unmanaged process. I have code that works to load the runtime via COM and I can load assemblies into the AppDomain and execute code just fine. However, I run into problems with applications that are hosted on a…
Rick Strahl
  • 17,302
  • 14
  • 89
  • 134
7
votes
2 answers

How can I know which Runtime Host is currently run my code?

As Microsoft Documentation declare Runtime Hosts that .NET have more than one Runtime Hosts to support and execute the code of our application, my question is How Can I know which Runtime Hosts of the Microsoft Runtime hosts, is hosting my code. I…
Niklaus Wirth
  • 820
  • 1
  • 7
  • 21
6
votes
1 answer

Custom AppDomainManager fails to start runtimeHost

I have following appDomainManager code public class HostAppDomainManager : AppDomainManager { public override void InitializeNewDomain(AppDomainSetup appDomainInfo) { this.InitializationFlags =…
np-hard
  • 5,725
  • 6
  • 52
  • 76
6
votes
1 answer

Is it possible to host the CLR in a C program?

Every example I can find is in C++, but I'm trying to keep my project in C. Is it even possible to host the CLR in a C program? If so, can you point me to an example?
David Brown
  • 35,411
  • 11
  • 83
  • 132
5
votes
3 answers

Is it possible to load two versions of the .NET runtime in the same process?

There are two scenarios I need to clarify: An executable compiled with .NET 3.5 needs to use a library compiled with .NET 1.1 and the library must run on the 1.1 runtime. An executable compiled with .NET 1.1 needs to use a library compiled with…
5
votes
1 answer

Catching a managed exception across native frames

Is it possible to have a managed exception thrown and caught by managed code but where there are intervening native frames on the call stack? I'm having trouble doing this. The app is 32-bit native code and hosts the MSCLR 2.0 (but most of the code…
Kevin
  • 1,179
  • 7
  • 18
3
votes
2 answers

Is there a common way for C# and unmanaged native C++ to determine installed CLR versions?

As the title says: Is there a common way in C# and especially unmanaged native C++ to determine installed CLR versions? This means not just checking whether the Framework is installed according this KB article. I want to do it by using the CLR…
Christoph Meißner
  • 1,511
  • 2
  • 21
  • 40
3
votes
2 answers

Can AppDomainManager be loaded by ProvideAssembly from a CLR Host?

I have an application hosting the .net clr with a custom AppDomain Manager and an AssemblyManager with a store. This all works fine when the Assembly with the AppDomainManager in is a dll in the same directory as the executable. What I want to do is…
1
2 3 4