Skip to content

Empty DOTNET_STARTUP_HOOKS causes error entries in Application log in Windows. #82260

@BertanAygun

Description

@BertanAygun

Description

In Visual Studio service hub process, we set DOTNET_STARTUP_HOOKS variable to empty string via ProcessStartInfo.Environment indexer.

In .Net runtime 6.0.13, this is causing errors as below in the Application log:

Description: A .NET application failed.
Application: ServiceHub.Host.Extensibility.exe
Path:
Message: Failed to read environment variable [DOTNET_STARTUP_HOOKS], HRESULT: 0x800700CB

These errors can be confusing as the application doesn't actually fail due to this error and continues to execute.

Reproduction Steps

Set DOTNET_STARTUP_HOOKS to empty string via ProcessStartInfo in a console app and launch the process.

Expected behavior

No errors to be logged as empty DOTNET_STARTUP_HOOKS seem to be a valid value.

Actual behavior

A misleading error entry is logged.

Regression?

Not sure

Known Workarounds

Ignoring the error

Configuration

.Net runtime 6.0.13
Windows 11, amd64

I don't believe this is configuration specific but haven't tested.

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions