Skiasharp: Support Windows Nano Server

Created on 6 Nov 2018  Â·  13Comments  Â·  Source: mono/SkiaSharp

Description

Windows Nano Server is missing some dlls, so SkiaSharp does not work. Related to https://github.com/mono/SkiaSharp/issues/591

Having a look at Nano Server... Ran the NanoServerApiScan.exe tool from: https://blogs.technet.microsoft.com/nanoserver/2016/04/27/nanoserverapiscan-exe-updated-for-tp5/

=== libSkiaSharp.dll ===

ERRORS:

  FONTSUB.dll
    CreateFontPackage(Proc not found)
  USER32.dll
    SystemParametersInfoW(Proc not found)
  MSVCP140.dll
    …
    …
    …
      Please copy Nano Server compliant MSVCP140.dll from %ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\redist\onecore\x64\Microsoft.VC140.CRT\
  VCRUNTIME140.dll
    …
    …
    …
      Please copy Nano Server compliant VCRUNTIME140.dll from %ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\redist\onecore\x64\Microsoft.VC140.CRT\

I need to investigate the 2 usages that appear to be bad:

  • FONTSUB.dll (CreateFontPackage)
  • USER32.dll (SystemParametersInfoW)

Just did some investigation :)

CreateFontPackage from FONTSUB.dll is just for XPS support - and this is also just for font subsetting. The UWP build does not have this at all, so I could just remove it for a nano build.

SystemParametersInfoW from USER32.dll is also not too essential - it is just for determining the default font. Again, this is not available for UWP - we just pick the "Segoe UI" which we know is available by default.

Nano Server support could very well be possible in the near future - just have to check priorities.

Add your vote to this issue so we can prioritize this issue.

VS bug #727251

area-SkiaSharp area-libSkiaSharp.native os-Windows-Classic status-low-priority type-feature-request

Most helpful comment

We just ran into this issue while trying to deploy an ASP.Net Core microservice dependent on SkiaSharp with the microsoft/dotnet:2.2-aspnetcore-runtime image.

Are there any news regarding this? 😢

All 13 comments

We just ran into this issue while trying to deploy an ASP.Net Core microservice dependent on SkiaSharp with the microsoft/dotnet:2.2-aspnetcore-runtime image.

Are there any news regarding this? 😢

@mattleibow Are there any news or other issues to follow related with this?

@mattleibow We encountered the same problem when deploying Azure Functions. Are there any news about this?

Hi Team,

Are there any news regarding this?

Regards,
Vijayasurya A

Sounds like we just need a new target externals-nano-server and leave out the parts that depend on not supported api. So in the end this is mostly how the UWP build works.

We just need to figure out how we would actually package this. Right now the Win32 is in the main NuGet. We might need to see how devs would use this. Will they use VS on Windows and do testing, and then deploy to Nano? If so, we need to find a way to have dotnet publish (and similar) to actually use the Nano binaries. That will probably be the hardest part - how do we distinguish between desktop vs nano Win32? NuGet has RIDs, but this is just win-xxx versions. Unless there is a more specific one for Nano?

I feel like I opened an issue for this already... somewhere...

Found it: https://github.com/NuGet/Home/issues/7375 Seems they closed it and want me to do the work. Not going to happen 😉 They must step up to make the NuGet feature actually not just a patch-job for UWP.

Just wrapped the NanoServerApiScan tool in a nice .NET Core tool: https://github.com/mattleibow/nano-api-scan

nano-api-scan path/to/libSkiaSharp.dll

After switching to static builds and Clang, we now only have a single method that we have to worry about:

=== libSkiaSharp.dll ===

ERRORS:

  FONTSUB.dll
    CreateFontPackage(Proc not found)

Good news! I think we can get Nano Server in for the next release I am planning next week if this build goes well: https://github.com/mono/SkiaSharp/pull/1013/commits/b265b430f098259fc5bba2d4b8531cec1c37d311

Pretty much, I can exclude the usage in the comment above and no one woulds care - that is just for the experimental XPS document type subsetter. I have no numbers, but I don't think anyone would use that as we have better PDF support. Who uses XPS anyway? Hoping that the logic that I have for the "no dependencies" build of linux can be reused to created a "nano server" build.

From what I can see so far, we could get this working. Not going to be the prettiest at the moment because of the way the PackageReference and things work - and the open issue on NuGet (https://github.com/NuGet/Home/issues/7375) makes is messy.

But, the usage looks to be:

<PackageReference Include="SkiaSharp" ExcludeAssets="native" />
<PackageReference Include="SkiaSharp.NativeAssets.NanoServer" />

This is basically saying work as normal, but instead of using the native runtime bits from "SkiaSharp", ignore it and use the "SkiaSharp.NativeAssets.NanoServer" instead. This only has to be done on the top-level app as the runtimes are only used on dotnet run and dotnet publish.

Not sure if this will work nicely, need to do a bit of testing. Fingers crossed.

Heh, I think I was getting ahead of myself... next week is like Wednesday and there is no way a reasonable person should go stable with just a weekend hack :) Moved it out to a new PR #1014 that I will merge after I release. I want to try and get a more frequent release cadence with SkiaSharp - and give people more time to actually test Nano Server.

I think I am almost ready to get this in with #1040 So far, Nano Server seems to be working

Merged into master! Will push out some packages to the early-access feed as soon as CI is done. Also hope to go public preview soon as well.

Just linking this new issue : https://github.com/NuGet/Home/issues/8894

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dsadlowski picture dsadlowski  Â·  3Comments

alanricker picture alanricker  Â·  3Comments

parthipanr picture parthipanr  Â·  4Comments

joreg picture joreg  Â·  4Comments

ReactorScram picture ReactorScram  Â·  3Comments