Skip to content

Commit 1747bdb

Browse files
committed
Save additional ms by not parsing TargetFrameworkName on .NET Core
1 parent 6adbe4d commit 1747bdb

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/Microsoft.DotNet.Wpf/src/Common/src/System/AppContextDefaultValues.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,19 @@ internal static partial class AppContextDefaultValues
1919
{
2020
public static void PopulateDefaultValues()
2121
{
22-
string platformIdentifier, profile;
23-
int version;
24-
25-
ParseTargetFrameworkName(out platformIdentifier, out profile, out version);
22+
#if NETFX
23+
// Get Target Framework information
24+
ParseTargetFrameworkName(out string platformIdentifier, out string profile, out int version);
2625

2726
// Call into each library to populate their default switches
2827
PopulateDefaultValuesPartial(platformIdentifier, profile, version);
28+
#else
29+
// Call into each library to populate their default switches
30+
// ".NETCoreApp,Version=v3.0"
31+
PopulateDefaultValuesPartial(".NETCoreApp", string.Empty, 30000);
32+
#endif
2933
}
30-
34+
#if NETFX
3135
/// <summary>
3236
/// We have this separate method for getting the parsed elements out of the TargetFrameworkName so we can
3337
/// more easily support this on other platforms.
@@ -181,7 +185,7 @@ private static bool TryParseFrameworkName(String frameworkName, out String ident
181185

182186
return true;
183187
}
184-
188+
#endif
185189
// This is a partial method. Platforms (such as Desktop) can provide an implementation of it that will read override value
186190
// from whatever mechanism is available on that platform. If no implementation is provided, the compiler is going to remove the calls
187191
// to it from the code

0 commit comments

Comments
 (0)