Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,7 @@ private string[] ExecuteProcessAndReturnParsedOutput(Dictionary<string, string>
// To mimic this behaviour, we can't use Environment.SetEnvironmentVariable here as it's case-insensitive on Windows.
// We also can't use p.StartInfo.Environment as it's comparer is set to OrdinalIgnoreCAse.
// But we can overwrite it using reflection to mimic the CreateProcess behaviour and avoid having this test call CreateProcess directly.
p.StartInfo.Environment
.GetType()
Type.GetType("System.Collections.Specialized.DictionaryWrapper, System.Diagnostics.Process")!
.GetField("_contents", Reflection.BindingFlags.NonPublic | Reflection.BindingFlags.Instance)
.SetValue(p.StartInfo.Environment, envVars);

Comment thread
MichalStrehovsky marked this conversation as resolved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,7 @@ Process CreateNonChildProcess()

private static IDictionary GetWaitStateDictionary(bool childDictionary)
{
Assembly assembly = typeof(Process).Assembly;
Type waitStateType = assembly.GetType("System.Diagnostics.ProcessWaitState");
Type waitStateType = Type.GetType("System.Diagnostics.ProcessWaitState, System.Diagnostics.Process")!;
FieldInfo dictionaryField = waitStateType.GetField(childDictionary ? "s_childProcessWaitStates" : "s_processWaitStates", BindingFlags.NonPublic | BindingFlags.Static);
return (IDictionary)dictionaryField.GetValue(null);
Comment thread
MichalStrehovsky marked this conversation as resolved.
}
Expand All @@ -974,7 +973,8 @@ private static object GetProcessWaitState(Process p)

private static int GetWaitStateReferenceCount(object waitState)
{
FieldInfo referenCountField = waitState.GetType().GetField("_outstandingRefCount", BindingFlags.NonPublic | BindingFlags.Instance);
FieldInfo referenCountField = Type.GetType("System.Diagnostics.ProcessWaitState, System.Diagnostics.Process")!
.GetField("_outstandingRefCount", BindingFlags.NonPublic | BindingFlags.Instance);
return (int)referenCountField.GetValue(waitState);
Comment thread
MichalStrehovsky marked this conversation as resolved.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-android;$(NetCoreAppCurrent)-maccatalyst</TargetFrameworks>
<IgnoreForCI Condition="'$(TargetOS)' == 'browser'">true</IgnoreForCI>
<!-- https://github.com/dotnet/runtime/issues/126862 -->
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
Expand Down
Loading