-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
SDK version of hostfxr.dll cannot initialize self-contained app #56968
Comments
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsDescriptionWhen a native host uses the default .NET SDK version of
If the native host instead directly loads the Configuration.NET 5 Trace
|
This was never supposed to work. The call to The call to get_hostfxr_parameters params;
params.size = sizeof(params);
params.assembly_path = pathToTheManagedDll;
params.dotnet_root = NULL;
int rc = get_hostfxr_path(buffer, &buffer_size, ¶ms); This will:
With this, the followup call to I understand that this can be a bit confusing - but self-contained really assumes that the native hosting knows about it to a point. |
@vitek-karas does that statement applies to plugins? I am trying an upgrade to avoid a memory leak in .net 5, but I am also facing a "InvalidOperationException: Cannot load hostpolicy library". I imagine plugins has not been broken for self contained apps in .net 6, right? |
@freddyrios Plugins should work just fine with self-contained app - I assume by "plugins" you mean using If you're running into problems, please create a new issue on the topic, I would be definitely very interested if something's broken. |
Closing this as effectively by design. |
@vitek-karas yes. I reproduced it with a new app following https://docs.microsoft.com/en-us/dotnet/core/tutorials/creating-app-with-plugin-support, but still making sure I am not doing something wrong. Edit: effectively, did something wrong. Won't be able to check if something similar was happening with the full app until tomorrow at work. |
@vitek-karas unfortunately I only made the mistake when confirming it is a regression, got a clean reproduction and filed a bug: #59961 |
Description
When a native host uses the default .NET SDK version of
hostfxr.dll
(the one returned byget_hostfxr_path(buffer, size, nullptr)
) to initialize a self-contained app,hostfxr_initialize_for_dotnet_command_line
fails with error:If the native host instead directly loads the
hostfxr.dll
from the app path then the error does not occur and the app is initialized properly.If the app is executed by
dotnet.exe <app.dll>
then the app can start too.Configuration
.NET 5
Windows 10 21H1 x64
Trace
The text was updated successfully, but these errors were encountered: