.NET 9 Process.Start crash due to CETCompat

Open
#109,682 14 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
csharp

Research direction

Start with the provided ProcessStartInfo and Process.Start reproduction on Windows, comparing .NET 9 with .NET 8 and CETCompat enabled versus disabled. Investigate the ntd.dll 0xc0000409 crash when Verb="runas" is used; done means the regression is reproduced and the crash is fixed or its cause and supported workaround are documented.

Written by the indexing model from the issue text.

Description

area-VM-coreclr
Description

Note - I am not sure if this intended, opening just in case it's not.
Starting a Process as admin seems to crash on ntd.dll 0xc0000409 due to the CET support introduced in .NET 9.

Reproduction Steps

For some reason this does not reproduce in all PCs, I couldn't find any pattern to why.
In my case it happens to users of my app when they try to open executable files as admin.
It's done by starting a Process with Verb="runas".

var processStartInfo = new ProcessStartInfo(filePath)
{
    UseShellExecute = true,
    Arguments = args,
    WorkingDirectory = Path.GetDirectoryName(filePath)!
};
var process = new Process
{
    StartInfo = processStartInfo
};

processStartInfo.Verb = "runas";
process.Start();
Expected behavior

The .NET process to not crash.

Actual behavior

The .NET process crashes with ntd.dll 0xc0000409, no stack trace.

Regression?

This was not an issue in .NET 8.

Known Workarounds

Use <CETCompat>false</CETCompat> solves the issue.

Configuration

No response

Other information

No response

Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.