Skip to content
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

StartupHook is preventing launching of child .NET processes #1318

Closed
NCarlsonMSFT opened this issue Feb 7, 2023 · 5 comments · Fixed by #1539
Closed

StartupHook is preventing launching of child .NET processes #1318

NCarlsonMSFT opened this issue Feb 7, 2023 · 5 comments · Fixed by #1539

Comments

@NCarlsonMSFT
Copy link

Similar to the issue with Hot Reload (dotnet/runtime#58000) when StarHostAction in the Azure Functions CLI sets DOTNET_STARTUP_HOOKS it should be cleared in StartupHook to prevent all child processes from inheriting the environment variable and failing to run.

This is currently blocking the ability to use the VisualStudioCredential from Azure.Identity in some scenarios as it relies on starting a child process.

@ghost ghost assigned brettsam Feb 7, 2023
@fabiocav
Copy link
Member

fabiocav commented Feb 8, 2023

Thanks @NCarlsonMSFT . This is reasonable and we'll have this reviewed.

In the meantime, you can workaround the issue by clearing that startup hook reference in debugging scenarios (or always, if you always want to suppress that behavior)

@jsheetzmt
Copy link

jsheetzmt commented May 8, 2023

Also interested in this as we are trying to use VisualStudioCredential for AAD authentication with isolated functions + Docker containers.

This is the error we are getting:

[2023-05-08T15:58:08.134Z] - Process "/TokenService.Proxy/TokenService.Proxy" has failed with unexpected error: Unhandled exception. System.ArgumentException: Startup hook assembly 'Microsoft.Azure.Functions.Worker.Core' failed to load. See inner exception for details.
[2023-05-08T15:58:08.134Z]  ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Azure.Functions.Worker.Core, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

@NCarlsonMSFT
Copy link
Author

@jsheetzmt: I've updated my sample to include an Isolated Azure function with a work-around for this bug: https://github.com/NCarlsonMSFT/VisualStudioCredentialExample/blob/master/FunctionAppIsolated/Program.cs

@jsheetzmt
Copy link

Thanks @NCarlsonMSFT, that did the trick :)

@fabiocav fabiocav added this to the Functions Sprint 146 milestone May 8, 2023
@fabiocav
Copy link
Member

Adding context to the issue on the file that would need to be modified to handle this: https://github.com/Azure/azure-functions-dotnet-worker/blob/main/src/DotNetWorker.Core/StartupHook.cs

@fabiocav fabiocav assigned jviau and unassigned fabiocav May 10, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants