Skip to content

Commit 7ed266e

Browse files
authored
Remove enable drawing on unix switch (#64084)
* Remove enable drawing on unix switch * Update some tests and not run tests that need Drawing on non Windows * PR Feedback, just turn off the switch
1 parent 35482cb commit 7ed266e

File tree

7 files changed

+8
-53
lines changed

7 files changed

+8
-53
lines changed

src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -87,34 +87,8 @@ private static bool GetLinqExpressionsBuiltWithIsInterpretingOnly()
8787
return !(bool)typeof(LambdaExpression).GetMethod("get_CanCompileToIL").Invoke(null, Array.Empty<object>());
8888
}
8989

90-
// Please make sure that you have the libgdiplus dependency installed.
91-
// For details, see https://docs.microsoft.com/dotnet/core/install/dependencies?pivots=os-macos&tabs=netcore31#libgdiplus
92-
public static bool IsDrawingSupported
93-
{
94-
get
95-
{
96-
#if NETCOREAPP
97-
if (!IsWindows)
98-
{
99-
if (IsMobile)
100-
{
101-
return false;
102-
}
103-
else if (IsOSX)
104-
{
105-
return NativeLibrary.TryLoad("libgdiplus.dylib", out _);
106-
}
107-
else
108-
{
109-
return NativeLibrary.TryLoad("libgdiplus.so", out _) || NativeLibrary.TryLoad("libgdiplus.so.0", out _);
110-
}
111-
}
112-
#endif
113-
114-
return IsNotWindowsNanoServer && IsNotWindowsServerCore;
115-
116-
}
117-
}
90+
// Drawing is not supported on non windows platforms in .NET 7.0+.
91+
public static bool IsDrawingSupported => IsWindows && IsNotWindowsNanoServer && IsNotWindowsServerCore;
11892

11993
public static bool IsAsyncFileIOSupported => !IsBrowser && !(IsWindows && IsMonoRuntime); // https://github.com/dotnet/runtime/issues/34582
12094

src/libraries/System.Drawing.Common/src/System/Drawing/LocalAppContextSwitches.Unix.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ namespace System
77
{
88
internal static partial class LocalAppContextSwitches
99
{
10-
private static int s_enableUnixSupport;
1110
public static bool EnableUnixSupport
1211
{
1312
[MethodImpl(MethodImplOptions.AggressiveInlining)]
14-
get
15-
{
16-
return GetCachedSwitchValue(@"System.Drawing.EnableUnixSupport", ref s_enableUnixSupport);
17-
}
13+
get => false;
1814
}
1915
}
20-
}
16+
}

src/libraries/System.Drawing.Common/tests/System.Drawing.Common.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
44
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
5-
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;net48</TargetFrameworks>
5+
<TargetFrameworks>$(NetCoreAppCurrent)-windows;net48</TargetFrameworks>
66
<IgnoreForCI Condition="'$(TargetsMobile)' == 'true'">true</IgnoreForCI>
77
</PropertyGroup>
88
<ItemGroup>

src/libraries/System.Drawing.Common/tests/runtimeconfig.template.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/libraries/System.Resources.Extensions/tests/runtimeconfig.template.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTestData.cs

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

src/libraries/System.Runtime.Serialization.Formatters/tests/runtimeconfig.template.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)