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

Custom CLR Host - "Pause"/"Resume" Application

I've been looking at the ability to pause and resume a .Net application as of late, particularly with an eye towards being able to pause an application, store its state, and launch it again later. I've been looking at the options provided by writing…
J Trana
  • 2,150
  • 2
  • 20
  • 32
1
vote
1 answer

How to split Dot Net Hosting function when calling via C++ dll

I am exploring calling .net methods from unmanaged C++ code and have found the function below in How To Inject a Managed .NET Assembly (DLL) Into Another Process void StartTheDotNetRuntime() { // Bind to the CLR runtime.. ICLRRuntimeHost…
Bender
  • 1,688
  • 2
  • 14
  • 20
1
vote
1 answer

passing C# managed instances between C# and C++ when native process is hosting the .NET Core runtime

I am prototyping using the HostWitHostFxr sample which allows a native process to host .NET Core using the nethost and hostfxr libraries. https://github.com/dotnet/samples/tree/master/core/hosting/HostWithHostFxr I am trying to return an instance of…
1
vote
2 answers

How to tell what version of the .NET CLR is loaded by a running application on XP?

I know that there are managed shell extensions loaded by explorer.exe on a computer. I want to know what version of the CLR is loaded into explorer.exe. If I am running Vista or Win7, I can use Process Explorer and look at the .NET Assemblies tab…
Jack Smith
  • 204
  • 3
  • 8
1
vote
1 answer

Is "mono_add_internal_call" just with CLR-Hosting possible?

is there any function to have the same possibilities like "mono_add_internal_call" in the CLR-Hosting w/o using mono? Mono C++ Code: static MonoString* Sample () { return mono_string_new (mono_domain_get(), "Hello!"); } mono_add_internal_call…
DogeAmazed
  • 858
  • 11
  • 28
1
vote
1 answer

Azure and native code

It looks like you can host native code on Azure: http://msdn.microsoft.com/en-us/library/dd573362.aspx. Is it possible to run a socket server (listening tcp/udp) here? And even hosting a CLR on top?
bertelmonster2k
  • 469
  • 2
  • 8
1
vote
2 answers

StackOverflowException in .NET >= 4.0 - give other threads chance to gracefully exit

Is there a way how to at least postpone termination of managed app (by few dozens of milliseconds) and set some shared flag to give other threads chance to gracefully terminate (the SO thread itself wouldn't obviously execute anything further)? I'm…
Jan
  • 1,905
  • 17
  • 41
1
vote
0 answers

SynchronizationContext.Current resets to null on every call from unmanaged host

I have Win32 application which hosts CLR runtime. No threads involved. Just main thread. And I found that on every call to managed side SynchronizationContext.Current resets to null. I did call SynchronizationContext.SetSynchronizationContext in…
1
vote
1 answer

Why CLRHosting API not working even if the GetLastError is 0?

I am trying to load a managed C# dll into a managed C# process by following this tutorial. I have done a fair bit of coding in C/C++ and have working knowledge of MS COM, but C# and managed code is a completely new beast for me, so be forgiving if I…
Favonius
  • 13,959
  • 3
  • 55
  • 95
1
vote
1 answer

Is there any way to get ICLRMetaHost from c++ library

Pretty much what the question states. I have a .net exe that runs, and then loads my library (in c++). Is there any way to get the ICLRMetaHost, or similar interface, that mscoree loads when it starts up the .net exe? I want to do this primarily so…
Programmdude
  • 551
  • 5
  • 22
1
vote
1 answer

CLR hosting from managed code?

Is it possible to do some CLR hosting from a managed application? As the hosting API is exposed through COM the plumbing should be possible. Moreover, from the 4.0 version of the runtime, it's possible to host more than one CLR in the same…
Pragmateek
  • 13,174
  • 9
  • 74
  • 108
1
vote
2 answers

Is it possible to reload the CLR?

I'm fiddling with a project where the CLR is hosted within a C application. Is there a supported way to unlink the CLR and relaunch it?
JoshRivers
  • 9,920
  • 8
  • 39
  • 39
1
vote
1 answer

CLR's class loading services

I read topic from google and I understand this: Windows loader loads the exe or dll of .net app. Then windows loader creates clr for that process. Then it locates entry point to application and call it. But before that class loader service of…
yuthub
  • 67
  • 6
0
votes
0 answers

ICorRuntimeHost::GetDefaultDomain is deprecated; how do I get the same result in undeprecated CLR hosting code

This problem is about using wholly unmanaged C++ without using deprecated means. I am hosting the CLR in C++ calling (in order): CLRCreateInstance to get an ICLRMetaHost* . The ICLRMetaHost method GetRuntime to get an ICLRRuntimeInfo* for…
Sturt
  • 204
  • 7
0
votes
0 answers

CLR Host - how to execute functions with arbitrary method signature

I've a managed C# test DLL and I want to call its functions from my unmanaged C++ code. The problem is that I can't find an example that shows how to call arbitrary functions from my c++ code, I could only get the…
prom85
  • 16,896
  • 17
  • 122
  • 242