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

Resolve net core shared nullability #85

Merged
merged 2 commits into from
Aug 20, 2019

Conversation

COsborn2
Copy link
Contributor

No description provided.

@COsborn2 COsborn2 merged commit ff46a4c into v8.0 Aug 20, 2019
public static string GetNetCoreVersion()
{
Assembly assembly = typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly;
var assemblyCodeBase = assembly.CodeBase ?? throw new ArgumentNullException("assemblyCodeBase");
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is the correct exception type since "assemblyCodeBase" is not an argument. I would suggest using an InvalidOperationException.

var assemblyCodeBase = assembly.CodeBase ?? throw new ArgumentNullException("assemblyCodeBase");
string[] assemblyPath = assemblyCodeBase.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App");
if (netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2)
Copy link
Member

Choose a reason for hiding this comment

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

I realize this is the same as it was. But this code fails on *nix systems if Microsoft.NETCore.App is installed at the root.
"/Microsoft.NETCore.App"

@COsborn2 COsborn2 deleted the resolve-NetCoreShared-nullability branch September 24, 2019 19:37
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.

2 participants