sdk icon indicating copy to clipboard operation
sdk copied to clipboard

CLI uses typeof(object).GetTypeInfo().Assembly.Location to determine FX location

Open schellap opened this issue 10 years ago • 10 comments

If CoreCLR gets serviced, mscorlib's path will be in the servicing root and not the actual FX location.

Steps to reproduce

copy /y %USERPROFILE%\.nuget\packages\runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR\[Matching CLI Version]\ "C:\Program Files (x86)\dotnetextensions\pkgs\runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR\[Matching CLI Version]\"

dotnet publish

Expected behavior

FX dir determination should be derived from property APP_CONTEXT_DEPS_FILES and path containing Microsoft.NETCore.App.deps.json. See:

https://github.com/dotnet/cli/blob/803fef6a8b4838afd0e5f77e9e342d3e616d6c96/src/Microsoft.Extensions.DependencyModel/DependencyContextLoader.cs#L156

Actual behavior

https://github.com/dotnet/cli/blob/ac4c6702d5d345dc9c397f80290f105fedebe98b/src/Microsoft.DotNet.Cli.Utils/Muxer.cs#L38

Environment data

dotnet --info output:

schellap avatar Apr 14 '16 02:04 schellap

@brthor @piotrpMSFT @Sridhar-MS @gkhanna79

schellap avatar Apr 14 '16 02:04 schellap

@piotrpMSFT , who should pick this one up?

Petermarcu avatar Apr 14 '16 16:04 Petermarcu

I can pick this one...

schellap avatar Apr 17 '16 22:04 schellap

This would require host change to plumb the fx dir.

schellap avatar Apr 17 '16 22:04 schellap

I believe there are two changes required:

  1. Add the FX dir to AppContext - @schellap Please file an issue to fi this.
  2. Plumb the CLI to consume the FX dir - which is this issue. @brthor Should look into this.

gkhanna79 avatar Apr 18 '16 14:04 gkhanna79

Once we have this in AppContext, this should be a one line change:

https://github.com/dotnet/cli/blob/rel/1.0.0/src/Microsoft.DotNet.Cli.Utils/CoreHost.cs#L31

I believe @sokket was picking this one up?

brthor avatar Apr 18 '16 17:04 brthor

No issues guys, I'll make the fix.

schellap avatar Apr 18 '16 17:04 schellap

Filed https://github.com/dotnet/cli/issues/2558 against @schellap

gkhanna79 avatar Apr 18 '16 17:04 gkhanna79

This change needs to account for a number of codepaths

  • [ ] Muxer.cs
  • [ ] CoreHost.cs

@schellap told me today he'll be picking this up to test the CoreHost/Dotnet.exe changes. @schellap will you be doing this?

TheRealPiotrP avatar Apr 18 '16 23:04 TheRealPiotrP

Fixed by dotnet/cli#2617

TheRealPiotrP avatar Apr 21 '16 23:04 TheRealPiotrP