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

Identification MacOSX #9

Open
dubo opened this issue Feb 1, 2018 · 1 comment
Open

Identification MacOSX #9

dubo opened this issue Feb 1, 2018 · 1 comment

Comments

@dubo
Copy link

dubo commented Feb 1, 2018

Hi Eric,
I have problem run your library at MacOSX Darwin. Code in OciCalls.cs evaluate MacOSX and Ubuntu as Unix, platform ID 4 . I found solution atr https://stackoverflow.com/questions/38790802/determine-operating-system-in-net-core , see code below.

Problematic code in OciCalls.cs:
...

if ((int)Environment.OSVersion.Platform == 4 || (int)Environment.OSVersion.Platform == 128)
{
  mOciNativeCalls = new OciNativeCallsLinux();
}
else if ((int)Environment.OSVersion.Platform == 6)
{
  mOciNativeCalls = new OciNativeCallsMacOSX();
}
else
{
  mOciNativeCalls = new OciNativeCallsWindows();
}

...

I run simple test for OS envirement variables at MacOSX an Linux:

// -- I think, that this is better test as use Environment.OSVersion.Platform value
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows)) 
    osplatform = "Windows";
else if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX)) 
    osplatform = "OSX";
else if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux)) 
    osplatform = "Linux";
else
    osplatform = "Unknown";
Console.WriteLine("Enviroment OS: " + Environment.OSVersion.Platform + ", platform ID " + (int)Environment.OSVersion.Platform );
Console.WriteLine("OsPlatform   : " + osplatform);
Console.WriteLine("Architecture : " + System.Runtime.InteropServices.RuntimeInformation.OSArchitecture);
Console.WriteLine("OsDescription: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription);

Output

*** MacOSX Darwin ****
Enviroment OS: Unix, platform ID 4
OsPlatform : OSX
Architecture : X64
OsDescription: Darwin 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64

*** Linux Mit 18***
Enviroment OS: Unix, platform ID 4
OsPlatform : Linux
Architecture : X64
OsDescription: Linux 4.10.0-42-generic #46~16.04.1-Ubuntu SMP Mon Dec 4 15:57:59 UTC 2017

@ericmend
Copy link
Owner

Olá @dubo , sinceramente não consigo realizar testes em MacOS. Vou realizar a alteração e testar em Windows e Linux e gerar um novo nuget.

ericmend pushed a commit that referenced this issue Feb 20, 2018
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

No branches or pull requests

2 participants