Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RuntimeInformation.FrameworkDescription in DiscovererHelpers #7965

Merged
merged 1 commit into from
Sep 27, 2021

Conversation

steveisok
Copy link
Member

For reasons unknown, the first part of the IsRunningOnNetCoreApp check (Environment.Version.Major) was returning 0 for iOS & tvOS CI runs. The second part also failed because FrameworkDescription is no longer .NET Core. As a result, tests that should be skipped were no longer and causing unexpected failures on CI.

For reasons unknown, the first part of the IsRunningOnNetCoreApp check (Environment.Version.Major) was returning 0 for iOS & tvOS CI runs.  The second part also failed because FrameworkDescription is no longer .NET Core. As a result, tests that should be skipped were no longer and causing unexpected failures on CI.
@premun premun merged commit 3359a41 into dotnet:main Sep 27, 2021
@ViktorHofer
Copy link
Member

Should we follow-up on why the major version returns 0?

@steveisok
Copy link
Member Author

Should we follow-up on why the major version returns 0?

Yeah, that's my intent. Very strange.

@@ -14,7 +14,7 @@ internal static class DiscovererHelpers
{
private static readonly Lazy<bool> s_isMonoRuntime = new Lazy<bool>(() => Type.GetType("Mono.RuntimeStructs") != null);
public static bool IsMonoRuntime => s_isMonoRuntime.Value;
public static bool IsRunningOnNetCoreApp { get; } = (Environment.Version.Major >= 5 || RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase));
public static bool IsRunningOnNetCoreApp { get; } = (Environment.Version.Major >= 5 || RuntimeInformation.FrameworkDescription.StartsWith(".NET", StringComparison.OrdinalIgnoreCase));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@steveisok this is wrong since it'll start returning true on .NET Framework since that also starts with .NET.

I'd do !RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", ... instead.

steveisok pushed a commit to steveisok/arcade that referenced this pull request Sep 29, 2021
dotnet#7965 wasn't quite right as it would be true on full framework
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants