-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the GetCLRRuntimeHost export from coreclr binary #52688
Comments
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsThe runtime/src/coreclr/vm/corhost.cpp Lines 861 to 868 in acb4c46
The new API is officially documented with guidance and a sample can be found here.
|
If and when this happens, we should make sure it gets announced / tagged as a breaking change. The startup flags should be achievable through runtime config properties via our recommended hosting APIs. I think the only AppDomain flags used in
We should also have a better story for things like loading in the default ALC to replace |
If it gets removed, what would be the suggested way to do things like |
@elinor-fung has been working on a solution to this problem. I believe it is a .NET 8 plan, but that will need to exist before we can remove this API.
There are two approaches. The first is to NativeAOT your library and the second is to use the approach that is taken by DNNE. |
I don't think that applies in this case. If I understand it correctly Snoop wants to effectively call into already running managed code - I think it's something like a UI inspector tool which you "attach" to a process. So NativeAOT approach is not applicable because that would not attach to the existing runtime. And DNNE will run into the same limitation as mentioned above because it also relies on nethost/hostfxr. |
Excatly. Snoop injects itself into a running WPF application to allow users to inspect/modify the UI etc., similar to the live visual tree in Visual Studio. |
I was narrowly answering the question of "Is there any alternative to call .NET code from C++ without using managed C++?". NativeAOT and DNNE are the specific answers to that. For the combination of calling from C++ and attaching to an existing runtime instance, I agree that is more complicated. @elinor-fung's proposal, if I recall, is around getting access to the Default ALC and injecting into that so that would be the API. I was also under the impression that an already loaded hostfxr will know the current coreclr and can then "attach". If the desired runtime versions match, the DNNE approach would just need to call a different API for injection. I agree the NativeAOT approach is a non-starter for attaching and loading to an existing runtime instance. |
We currently have a way to get a function pointer to something already loaded into the default ALC, but no way to load an assembly in the default ALC. #77696 is the rough idea for adding a similar API that allows loading an assembly into the default ALC.
|
The original ask is probably based on the discussion here: #80092 |
Single-file wouldn't be a problem if the single-file host application would contain some exports from That way one could either look for a loaded The reason why i am using |
@batzen If the functionality exists in the single-file then I agree. But ideally the workflow using our hosting APIs would look the same (or very similar) for single-file and non-single-file. There's the added issue that we compile a slightly different version of hostfxr code into single-file - it can make certain assumptions and make the code smaller/faster. With this we would have to guarantee that it also provides all of the necessary functionality for hosting APIs to work correctly. Definitely doable, but I don't know if it's the case today. |
@vitek-karas I would go one step further and say the APIs must look the same. The hosting is already quite complex. Having to deal with different APIs would be very far from ideal. To get back to my original question: |
I agree - the problem is that the existing APIs might not be good enough to support it (specifically the nethost which returns path to |
Ah, thanks for the context - yeah, the existing APIs don't work with self-contained single-file and |
The
GetCLRRuntimeHost
export on thecoreclr
binary is a way to get at the COM interface hosting API that is no longer supported in .NET 5+. We should get rid of this API and simplify the internal initialization logic by removing the COM API style. Since it is no longer supported and we have no test coverage assets it is sitting there waiting to get broken.runtime/src/coreclr/vm/corhost.cpp
Lines 861 to 868 in acb4c46
The new API is officially documented with guidance and a sample can be found here.
/cc @vitek-karas @elinor-fung
The text was updated successfully, but these errors were encountered: