diff --git a/src/libraries/System.Private.CoreLib/src/System/Environment.GetFolderPathCore.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Environment.GetFolderPathCore.Unix.cs index 4ce955a3c401a..27dbc327aec73 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Environment.GetFolderPathCore.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Environment.GetFolderPathCore.Unix.cs @@ -14,8 +14,6 @@ namespace System { public static partial class Environment { - private static Func? s_directoryCreateDirectory; - private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOption option) { // Get the path for the SpecialFolder @@ -40,16 +38,7 @@ private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOptio Debug.Assert(option == SpecialFolderOption.Create); - Func? createDirectory = Volatile.Read(ref s_directoryCreateDirectory); - if (createDirectory is null) - { - Type dirType = Type.GetType("System.IO.Directory, System.IO.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", throwOnError: true)!; - MethodInfo mi = dirType.GetMethod("CreateDirectory", BindingFlags.Public | BindingFlags.Static)!; - createDirectory = mi.CreateDelegate>(); - Volatile.Write(ref s_directoryCreateDirectory, createDirectory); - } - - createDirectory(path); + Directory.CreateDirectory(path); return path; }