sdk icon indicating copy to clipboard operation
sdk copied to clipboard

HostFXR should service hostpolicy targeted by the app

Open gkhanna79 opened this issue 10 years ago • 45 comments

When HostFXR needs to lookup the serviced version of hostpolicy, it currently looks it up using the version/name info that was baked into it at compile-time, since it is updated in lock-step with hostpolicy.dll.

This will not work when we will need to publish a new hostfxr (which has a different version) that needs to work with existing SharedFX and load a serviced version of hostpolicy corresponding to the FX.

CC @piotrpMSFT @brthor

gkhanna79 avatar Apr 13 '16 01:04 gkhanna79

@gkhanna79 Does my recent exception working with a test shared framework app pertain to this issue?

Error loading hostpolicy 1.0.1-rc2-002296; interface mismatch between hostpolicy [32771] 
and hostfxr [120] Specifically, the structure of corehost_init_t has changed, do not know 
how to interpret it

guardrex avatar Apr 13 '16 02:04 guardrex

Can you try this workaround? https://github.com/dotnet/cli/issues/2389

schellap avatar Apr 13 '16 02:04 schellap

Could you please try removing 1.0.1-rc2-002296 and target the newer FX?

schellap avatar Apr 13 '16 02:04 schellap

@schellap Ok, but that host policy is being pulled in :sparkles: auto-magically :sparkles:

"dependencies": {
    "Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-*",
    "Microsoft.Extensions.Logging.Console": "1.0.0-*",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-*",
    "Microsoft.AspNetCore.Mvc": "1.0.0-*",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
    "Microsoft.NETCore.App": {
        "type": "platform",
        "version": "1.0.0-*"
    }
},
"frameworks": {
    "netcoreapp1.0": {
        "imports": [ "dnxcore50", "portable-net451+win8" ]
    }
},
.NET Command Line Tools (1.0.0-rc2-002363)

Product Information:
 Version:     1.0.0-rc2-002363
 Commit Sha:  065e8352fc

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 RID:         win10-x64

Perhaps, I should wait for -2392 and see if this issue clears up??

guardrex avatar Apr 13 '16 02:04 guardrex

   "Microsoft.NETCore.App": {
        "type": "platform",
        "version": "1.0.0-rc2-002363"
    }

The "version" field should be shared FX that you just installed. dir C:\Program Files\dotnet\shared\Microsoft.NETCore.App\

schellap avatar Apr 13 '16 02:04 schellap

Can you point me to what your runtimeconfig.json contains in the bin drop cotnains?

schellap avatar Apr 13 '16 02:04 schellap

@schellap Ok, thanks.

testshared.runtimeconfig.json

{
  "runtimeOptions": {
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "1.0.0-rc2-23931"
    }
  }
}

guardrex avatar Apr 13 '16 02:04 guardrex

dir C:\Program Files\dotnet\shared\Microsoft.NETCore.App\

or which dotnet relative dir?

schellap avatar Apr 13 '16 02:04 schellap

capture

guardrex avatar Apr 13 '16 02:04 guardrex

Can you target 1.0.0-rc2-3002363?

schellap avatar Apr 13 '16 02:04 schellap

I can, but I have the Azure VM deprovisioned, so I can't run the same test I ran earlier. I was planning on spinning it back up to test again in the morning. I can post back if you like with the result of the change to the TFM you provided tomorrow.

guardrex avatar Apr 13 '16 03:04 guardrex

The runtimeconfig.json will then be updated with this version and the host should pick it up and load the compatible hostpolicy.dll.

schellap avatar Apr 13 '16 03:04 schellap

@schellap Is the way I specified Microsoft.NETCore.App initially (-*) incorrect? ... or is this something that will just not happen shortly with updates?

guardrex avatar Apr 13 '16 03:04 guardrex

@GuardRex do you have a global.json in an ancestor of your working dir? Basically, it seems from the dotnet that got picked up, you have 1.0.0-rc2-002363, but do you have an global.json override?

From this:

.NET Command Line Tools (1.0.0-rc2-002363)

Product Information:
 Version:     1.0.0-rc2-002363
 Commit Sha:  065e8352fc

schellap avatar Apr 13 '16 03:04 schellap

No, I'm not using a global.json with any of my apps, including this test app.

guardrex avatar Apr 13 '16 03:04 guardrex

When I did a restore with 1.0.0-*:

I got this error. May be they should make it red in color or something.

error: Unable to resolve 'Microsoft.NETCore.App (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.

schellap avatar Apr 13 '16 03:04 schellap

Not happening here ...

log  : Restoring packages for c:\_APPLICATIONS\testshared\project.json...
info :   CACHE https://myget-2e16.kxcdn.com/artifacts/aspnetcidev/nuget/v3/flatcontainer/microsoft.aspnetcore.diagnostics/index.json
info :   CACHE https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.diagnostics/index.json
info :   CACHE https://myget-2e16.kxcdn.com/artifacts/aspnetcidev/nuget/v3/flatcontainer/microsoft.aspnetcore.server.iisintegration/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.server.iisintegration/index.json
info :   CACHE https://myget-2e16.kxcdn.com/artifacts/aspnetcidev/nuget/v3/flatcontainer/microsoft.extensions.logging.console/index.json
info :   CACHE https://api.nuget.org/v3-flatcontainer/microsoft.extensions.logging.console/index.json
info :   CACHE https://myget-2e16.kxcdn.com/artifacts/aspnetcidev/nuget/v3/flatcontainer/microsoft.aspnetcore.staticfiles/index.json
info :   CACHE https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.staticfiles/index.json
info :   CACHE https://myget-2e16.kxcdn.com/artifacts/aspnetcidev/nuget/v3/flatcontainer/microsoft.aspnetcore.mvc/index.json
info :   CACHE https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc/index.json
info :   CACHE https://myget-2e16.kxcdn.com/artifacts/aspnetcidev/nuget/v3/flatcontainer/system.security.cryptography.algorithms/index.json
info :   CACHE https://api.nuget.org/v3-flatcontainer/system.security.cryptography.algorithms/index.json
info :   CACHE https://myget-2e16.kxcdn.com/artifacts/aspnetcidev/nuget/v3/flatcontainer/system.security.cryptography.x509certificates/index.json
info :   CACHE https://api.nuget.org/v3-flatcontainer/system.security.cryptography.x509certificates/index.json
info :   CACHE https://myget-2e16.kxcdn.com/artifacts/aspnetcidev/nuget/v3/flatcontainer/microsoft.aspnetcore.server.kestrel/index.json
info :   CACHE https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.server.kestrel/index.json
info :   NotFound https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.server.iisintegration/index.json 231ms
info :   CACHE https://myget-2e16.kxcdn.com/artifacts/aspnetcidev/nuget/v3/flatcontainer/microsoft.netcore.app/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json
info :   NotFound https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json 242ms
info : Committing restore...
log  : Writing lock file to disk. Path: c:\_APPLICATIONS\testshared\project.lock.json
log  : c:\_APPLICATIONS\testshared\project.json
log  : Restore completed in 2860ms.

NuGet Config files used:
    c:\_APPLICATIONS\testshared\NuGet.Config
    C:\Users\XXXXX\AppData\Roaming\NuGet\NuGet.Config

Feeds used:
    https://www.myget.org/F/aspnetcidev/api/v3/index.json
    https://api.nuget.org/v3/index.json

guardrex avatar Apr 13 '16 03:04 guardrex

Why do I have a feeling I found another one??? :imp:

guardrex avatar Apr 13 '16 03:04 guardrex

md temp & cd temp dotnet new dotnet restore

Now change the project.json and do a restore?

schellap avatar Apr 13 '16 03:04 schellap

capture

guardrex avatar Apr 13 '16 03:04 guardrex