Standalone exe failing to load clrcompression.dll to unzip file.
Steps to reproduce
Build https://gist.github.com/russellhadley/63d8e4bdd856bc5e29c201cbde36c09e as a stand alone exe.
Publish to a seperate "bin" directory
Run exe in a directory with the attached Product.zip.
Expected behavior
Product.zip will be unzipped and produce a Product directory and sub directories.
Actual behavior
clrcompression.dll fails to load. Under windbg this the exception returns:
"Unable to load DLL 'clrcompression.dll': This operation is only valid in the context of an app container. (Exception from HRESULT: 0x8007109A)"
The clrcompression.dll I expect to load is in the publish directory but there some issue I'm not familiar with that is hitting the loadLibray for the dll.
This example runs fine on OSX with a dotnet of the same version as below.
Environment data
dotnet --info output:
.NET Command Line Tools (1.0.0-rc2-002673)
Product Information: Version: 1.0.0-rc2-002673 Commit Sha: c0aeb91d61
Runtime Environment: OS Name: Windows OS Version: 10.0.10586 OS Platform: Windows RID: win10-x64
@schellap @gkhanna79 @ericstj it's not clear to me where the associated warning is coming from. Can any of you shed some light on this?
I took a look at this with @russellhadley and noticed that the DLL was present in the folder. The host passes the right path and coreclr passes the right path to LoadLibraryExW. One thing I noticed was the clrcompression.dll comes from win10-x64. My APISets alarms went off immediately. But this is a standalone app, so forwarders are present in the app base. From the exception message, my guess is it appears this DLL is either an UWP AppX DLL or a onecore binary, causing a mismatch with the dotnet host process, which the OS doesn't allow.
@piotrpMSFT This means that the binary was built with the AppX bit set that can only be used within the AppX container. It needs to have that flag unset. @weshaggard PTAL.
From @ericstj in https://github.com/aspnet/dnx/issues/3378#issuecomment-200004525
win10 - contains API set dlls since almost all are inbox. Right now this RID should only be used by UWP apps since there is a case with CLRCompression where we package the appx DLL under this RID.
Quick Side Question: Is that guidance still in effect for RC2 release and apps destined for WS 2016/Nano/Win10 that are web apps that will be running under IIS?
I'm partially asking for my own apps, but this is the advice we're giving on JabbR to those interested in creating self-contained apps (stick with win81-x64). There is still no official sample of a self-contained app that we can track https://github.com/aspnet/cli-samples/issues/36.
@russellhadley, this line seems like the cause:
https://github.com/russellhadley/mcgutils/blob/master/src/cijobs/project.json#L21
Could you please change it to win7-x64 and give it a shot? In your PJ, you are effectively saying your app will run only on win10 (and potentially above) machines.
@schellap I can confirm that win81-x64 and win7-x64 works. It was confusing to me since I think that I just used the dotnet --info to grab the rid for the machine I was on. Where should I have gotten this guidance? (for standalone command line exe)
@ericstj, @weshaggard I thought we fixed this in the Compression package? Only "aot" runtimes should get the AppX version of the native DLL.
I think @ianhays fixed it recently with PR https://github.com/dotnet/corefx/pull/7840.
Yeah, I moved the AppX clrcompression to lib/netcore50 so it shouldn't be restoring on non-aot runtimes.
Either way though the RID used should be win7-x64
win10-x64 should be fine, unless I'm missing something. You should only get the AppX version if you target netcore50.
win10-x64 should be fine, unless I'm missing something. You should only get the AppX version if you target netcore50.
But we don't have a non-AppX version for win10, so wouldn't you just not get anything?
I am targeting netcore50. The commandline tools I'm building need to run across Linux, Windows, and OSX so I was trying to target the portable surface available xplat.
I am targeting netcore50
netcore50 is the moniker used for UWP 10 apps. Even with the packaging fixes, targeting netcore50 and win10 will get you the UWP version of Clrcompression.dll
The commandline tools I'm building need to run across Linux, Windows, and OSX so I was trying to target the portable surface available xplat.
Or, better yet. netcoreapp1.0.