dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.36k stars 4.74k forks source link

System.ComponentModel.Win32Exception : An error occurred trying to start process 'notepad.exe' with working directory 'C:\h\w\9F8D0903\w\B7E309C0\e'. Access is denied #90406

Open Maoni0 opened 1 year ago

Maoni0 commented 1 year ago

Build

https://dev.azure.com/dnceng-public/public/_build/results?buildId=302756&view=results

https://helixre107v0xdcypoyl9e7f.blob.core.windows.net/dotnet-runtime-refs-pull-87372-merge-563116f2d3404bad82/System.Diagnostics.Process.Tests/1/console.b1eb782a.log?helixlogtype=result

C:\h\w\9F8D0903\w\B7E309C0\e>"C:\h\w\9F8D0903\p\dotnet.exe" exec --runtimeconfig System.Diagnostics.Process.Tests.runtimeconfig.json --depsfile System.Diagnostics.Process.Tests.deps.json xunit.console.dll System.Diagnostics.Process.Tests.dll -xml testResults.xml -nologo -nocolor -trait category=OuterLoop -notrait category=IgnoreForCI -notrait category=failing  
  Discovering: System.Diagnostics.Process.Tests (method display = ClassAndMethod, method display options = None)
  Discovered:  System.Diagnostics.Process.Tests (found 12 of 290 test cases)
  Starting:    System.Diagnostics.Process.Tests (parallel test collections = on, max threads = 2)
    System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList(useShellExecute: True) [FAIL]
      System.ComponentModel.Win32Exception : An error occurred trying to start process 'notepad.exe' with working directory 'C:\h\w\9F8D0903\w\B7E309C0\e'. Access is denied.
      Stack Trace:
        /_/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs(92,0): at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
        /_/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs(25,0): at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
        /_/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs(1282,0): at System.Diagnostics.Process.Start()
        /_/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs(1350,0): at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
        /_/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs(1308,0): at System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList(Boolean useShellExecute)
           at InvokeStub_ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList(Object, Object, IntPtr*)
           at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
  Finished:    System.Diagnostics.Process.Tests

Build leg reported

System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList

Pull Request

https://github.com/dotnet/runtime/pull/87372

Known issue core information

Fill out the known issue JSON section by following the step by step documentation on how to create a known issue

 {
    "ErrorMessage" : "",
    "BuildRetry": false,
    "ErrorPattern": "System.ComponentModel.Win32Exception : An error occurred trying to start process .* with working directory",
    "ExcludeConsoleLog": false
 }

@dotnet/dnceng

Release Note Category

Additional information about the issue reported

No response

Report

Build Definition Test Pull Request
866282 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList
864919 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList dotnet/runtime#109648
863412 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList
863396 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList
863200 dotnet/runtime Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkDependentAppLaunch.ComputedTPA_NoTrailingPathSeparator dotnet/runtime#109526
862427 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList
861000 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList
859085 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList
856417 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList
854476 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList
853278 dotnet/runtime Microsoft.NET.HostModel.MachO.CodeSign.Tests.SigningTests.SignedHelloWorldRuns dotnet/runtime#108992
852162 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList
848999 dotnet/runtime Microsoft.NET.HostModel.MachO.CodeSign.Tests.SigningTests.SignedHelloWorldRuns dotnet/runtime#108992
848996 dotnet/runtime Microsoft.NET.HostModel.MachO.CodeSign.Tests.SigningTests.SignedHelloWorldRuns dotnet/runtime#108992
847986 dotnet/runtime Microsoft.NET.HostModel.MachO.CodeSign.Tests.SigningTests.SignedHelloWorldRuns dotnet/runtime#108992
847470 dotnet/runtime HostActivation.Tests.SelfContainedAppLaunch.RelativeEmbeddedPath dotnet/runtime#108992
846573 dotnet/runtime HostActivation.Tests.SelfContainedAppLaunch.RelativeEmbeddedPath dotnet/runtime#108992

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 1 17

Known issue validation

Build: :mag_right: Result validation: :warning: Provided build not found. Provide a valid build in the "Build: :mag_right:" line. Validation performed at: 8/11/2023 4:35:48 PM UTC

missymessa commented 1 year ago

@Maoni0 It looks like this error is impacting Runtime only. Is this an infra failure or a failure specific to Runtime tests?

ghost commented 1 year ago

Tagging subscribers to this area: @dotnet/area-system-diagnostics-process See info in area-owners.md if you want to be subscribed.

Issue Details
### Build https://dev.azure.com/dnceng-public/public/_build/results?buildId=302756&view=results https://helixre107v0xdcypoyl9e7f.blob.core.windows.net/dotnet-runtime-refs-pull-87372-merge-563116f2d3404bad82/System.Diagnostics.Process.Tests/1/console.b1eb782a.log?helixlogtype=result ``` C:\h\w\9F8D0903\w\B7E309C0\e>"C:\h\w\9F8D0903\p\dotnet.exe" exec --runtimeconfig System.Diagnostics.Process.Tests.runtimeconfig.json --depsfile System.Diagnostics.Process.Tests.deps.json xunit.console.dll System.Diagnostics.Process.Tests.dll -xml testResults.xml -nologo -nocolor -trait category=OuterLoop -notrait category=IgnoreForCI -notrait category=failing Discovering: System.Diagnostics.Process.Tests (method display = ClassAndMethod, method display options = None) Discovered: System.Diagnostics.Process.Tests (found 12 of 290 test cases) Starting: System.Diagnostics.Process.Tests (parallel test collections = on, max threads = 2) System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList(useShellExecute: True) [FAIL] System.ComponentModel.Win32Exception : An error occurred trying to start process 'notepad.exe' with working directory 'C:\h\w\9F8D0903\w\B7E309C0\e'. Access is denied. Stack Trace: /_/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs(92,0): at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) /_/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs(25,0): at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) /_/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs(1282,0): at System.Diagnostics.Process.Start() /_/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs(1350,0): at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) /_/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs(1308,0): at System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList(Boolean useShellExecute) at InvokeStub_ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList(Object, Object, IntPtr*) at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr) Finished: System.Diagnostics.Process.Tests ``` ### Build leg reported System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList ### Pull Request https://github.com/dotnet/runtime/pull/87372 ### Known issue core information Fill out the known issue JSON section by following the [step by step documentation on how to create a known issue](https://github.com/dotnet/arcade/blob/main/Documentation/Projects/Build%20Analysis/KnownIssueJsonStepByStep.md#how-to-create-a-known-issue-step-by-step) ```json { "ErrorMessage" : "", "BuildRetry": false, "ErrorPattern": "System.ComponentModel.Win32Exception : An error occurred trying to start process .* with working directory", "ExcludeConsoleLog": false } ``` @dotnet/dnceng ### Release Note Category - [ ] Feature changes/additions - [ ] Bug fixes - [ ] Internal Infrastructure Improvements ### Release Note Description ### Additional information about the issue reported _No response_ ### Report |Build|Definition|Test|Pull Request| |---|---|---|---| |[372612](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372612)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372612&view=ms.vss-test-web.build-test-results-tab&runId=7914362&resultId=100220)|| |[372622](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372622)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372622&view=ms.vss-test-web.build-test-results-tab&runId=7914396&resultId=102031)|| |[372620](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372620)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372620&view=ms.vss-test-web.build-test-results-tab&runId=7914306&resultId=100377)|| |[372621](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372621)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372621&view=ms.vss-test-web.build-test-results-tab&runId=7914346&resultId=102133)|| |[372195](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372195)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372195&view=ms.vss-test-web.build-test-results-tab&runId=7900642&resultId=100292)|| |[372199](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372199)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372199&view=ms.vss-test-web.build-test-results-tab&runId=7900604&resultId=100346)|| |[372208](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372208)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372208&view=ms.vss-test-web.build-test-results-tab&runId=7900588&resultId=100415)|| |[372198](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372198)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=372198&view=ms.vss-test-web.build-test-results-tab&runId=7900620&resultId=100239)|| |[371834](https://dev.azure.com/dnceng-public/public/_build/results?buildId=371834)|dotnet/runtime|[System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList](https://dev.azure.com/dnceng-public/public/_build/results?buildId=371834&view=ms.vss-test-web.build-test-results-tab&runId=7890596&resultId=102044)|| |[371822](https://dev.azure.com/dnceng-public/public/_build/results?buildId=371822)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=371822&view=ms.vss-test-web.build-test-results-tab&runId=7890442&resultId=100565)|| |[371829](https://dev.azure.com/dnceng-public/public/_build/results?buildId=371829)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=371829&view=ms.vss-test-web.build-test-results-tab&runId=7890396&resultId=101673)|| |[371836](https://dev.azure.com/dnceng-public/public/_build/results?buildId=371836)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=371836&view=ms.vss-test-web.build-test-results-tab&runId=7890494&resultId=100374)|| |[371832](https://dev.azure.com/dnceng-public/public/_build/results?buildId=371832)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=371832&view=ms.vss-test-web.build-test-results-tab&runId=7890426&resultId=101723)|| |[371391](https://dev.azure.com/dnceng-public/public/_build/results?buildId=371391)|dotnet/runtime|[System.Diagnostics.Tests.ProcessStartInfoTests.StartInfo_NotepadWithContent_withArgumentList](https://dev.azure.com/dnceng-public/public/_build/results?buildId=371391&view=ms.vss-test-web.build-test-results-tab&runId=7881200&resultId=100033)|dotnet/runtime#90417| |[370943](https://dev.azure.com/dnceng-public/public/_build/results?buildId=370943)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=370943&view=ms.vss-test-web.build-test-results-tab&runId=7871138&resultId=100261)|| |[370940](https://dev.azure.com/dnceng-public/public/_build/results?buildId=370940)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=370940&view=ms.vss-test-web.build-test-results-tab&runId=7871074&resultId=100213)|| |[370953](https://dev.azure.com/dnceng-public/public/_build/results?buildId=370953)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=370953&view=ms.vss-test-web.build-test-results-tab&runId=7871048&resultId=100288)|| |[370941](https://dev.azure.com/dnceng-public/public/_build/results?buildId=370941)|dotnet/runtime|[System.IO.Pipes.Tests.NamedPipeTest_CurrentUserOnly_Unix.Connection_UnderDifferentUsers_BehavesAsExpected](https://dev.azure.com/dnceng-public/public/_build/results?buildId=370941&view=ms.vss-test-web.build-test-results-tab&runId=7871010&resultId=100222)|| #### Summary |24-Hour Hit Count|7-Day Hit Count|1-Month Count| |---|---|---| |4|18|18| ### Known issue validation **Build: :mag_right:** **Result validation: :warning:** Provided build not found. Provide a valid build in the "**Build: :mag_right:**" line. **Validation performed at:** 8/11/2023 4:35:48 PM UTC
Author: Maoni0
Assignees: -
Labels: `area-System.Diagnostics.Process`, `Known Build Error`, `needs-area-label`
Milestone: -
jeffhandley commented 1 year ago

Added this to the 9.0.0 milestone because of the frequency

adamsitnik commented 3 months ago

Triage:

StartInfo_NotepadWithContent_withArgumentList

StartInfo_NotepadWithContent_withArgumentList is not the only S.D.P test that starts notepad, but it's the only one that fails.

The difference is that it uses a different property to set the arguments:

https://github.com/dotnet/runtime/blob/80ffac50fcf51d20bc658a6fba62b6a5a36bebd7/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs#L1337

https://github.com/dotnet/runtime/blob/80ffac50fcf51d20bc658a6fba62b6a5a36bebd7/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs#L1101

But both properties are later mapped to a string:

https://github.com/dotnet/runtime/blob/87a32e758551f4f72c7a25245dc932c0bcb2c6ad/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs#L50

and the same sys-call is being performed:

https://github.com/dotnet/runtime/blob/87a32e758551f4f72c7a25245dc932c0bcb2c6ad/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs#L156C56-L156C71

So in theory, both should be equally stable.

When searching for ERROR_ACCESS_DENIED + ShellExecuteEx I've found https://devblogs.microsoft.com/oldnewthing/20101118-00/?p=12253, but we are already handling STA properly:

https://github.com/dotnet/runtime/blob/87a32e758551f4f72c7a25245dc932c0bcb2c6ad/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs#L169-L183

It's going to require further triage.

jeffhandley commented 3 months ago

We can defer this out of 9.0.0. It does have a notable hit count, but it's not new. I moved it to Future.