dotnet / corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.

Home Page:http://dot.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing implementation of System.OperatingSystem.IsWindows

teobugslayer opened this issue · comments

Hi all,

I am trying to write cross-platform code and my attempt to use IsWindows and IsWindowsVersionAtLeast fails:

  Generating native code
EXEC : warning : Method `[ZX]ZX.ConsoleDisplay.Init(int32,int32)` will always throw because: [TEMPORARY EXCEPTION MESSAGE] MissingMethod: Boolean System.OperatingSystem.IsWindows() [C:\Dev\ZX\ZX\ZX.csproj]
EXEC : warning : Method `[ZX]ZX.Program.ValidateCanRun()` will always throw because: [TEMPORARY EXCEPTION MESSAGE] MissingMethod: Boolean System.OperatingSystem.IsWindowsVersionAtLeast(Int32, Int32, Int32, Int32) [C:\Dev\ZX\ZX\ZX.csproj]

What are my options to rectify the problem?

Number of .NET 5 APIs are not available in CoreRT right now because we stopped synchronizing them with the runtime due to technical difficulties a couple months ago.

This will be resolved once this repo is fully migrated to dotnet/runtimelab (dotnet/runtimelab#4) where the managed APIs are already fully synchronized with the mainstream runtimes. We just don't have official builds and packages yet.

For now you need to stick to .NET 3.1 APIs.

Fixed in dotnet/runtimelab. Update your nuget feed to the one in https://github.com/dotnet/runtimelab/tree/feature/NativeAOT/samples/HelloWorld