sdk icon indicating copy to clipboard operation
sdk copied to clipboard

muxer can not be used to run standalone application

Open pakrym opened this issue 10 years ago • 12 comments

In unit test case this doesn't work because muxer can not find coreclr.dll

D:\github\dotnet\cli\artifacts\win10-x64\stage2\dotnet.exe exec C:\Users\pakrym\.nuget\packages\dotnet-test-xunit\1.0.0-dev-91790-12\lib\netstandardapp1.5\dotnet-test-xunit.dll --depsfile D:\github\dotnet\cli\test\dotnet-compile.Tests\bin\Debug\netstandardapp1.5\win7-x64\dotnet-compile.Tests.deps.json --additionalprobingpath C:\Users\pakrym\.nuget\packages D:\github\dotnet\cli\test\dotnet-compile.Tests\bin\Debug\netstandardapp1.5\dotnet-compile.Tests.dll

Trace:

Tracing enabled
--- Invoked host main = {
D:\github\dotnet\cli\artifacts\win10-x64\stage2\dotnet.exe
C:\Users\pakrym\.nuget\packages\dotnet-test-xunit\1.0.0-dev-91790-12\lib\netstandardapp1.5\dotnet-test-xunit.dll
--depsfile
D:\github\dotnet\cli\test\dotnet-compile.Tests\bin\Debug\netstandardapp1.5\win7-x64\dotnet-compile.Tests.deps.json
--additionalprobingpath
C:\Users\pakrym\.nuget\packages
D:\github\dotnet\cli\test\dotnet-compile.Tests\bin\Debug\netstandardapp1.5\dotnet-compile.Tests.dll
}
Resolved fxr [D:\github\dotnet\cli\artifacts\win10-x64\stage2\hostfxr.dll]...
Loaded library from D:\github\dotnet\cli\artifacts\win10-x64\stage2\hostfxr.dll
Tracing enabled
Own DLL path=[D:\github\dotnet\cli\artifacts\win10-x64\stage2\dotnet.dll]
Checking if CoreCLR path exists=[D:\github\dotnet\cli\artifacts\win10-x64\stage2\coreclr.dll]
Host operating in Muxer mode
--- Executing in muxer mode...
Runtime config [] is valid=[1]
Executing as a standlone app as per config file []
Could not load host policy library [C:\Users\pakrym\.nuget\packages\dotnet-test-xunit\1.0.0-dev-91790-12\lib\netstandardapp1.5]

/cc @schellap @piotrpMSFT @anurse @davidfowl

pakrym avatar Mar 25 '16 17:03 pakrym

Can you do dotnet exec --depsfile --add foo.dll. The way the host is invoked is the legacy way, not the shared fx supported way. This is exec mode operation.

schellap avatar Mar 25 '16 17:03 schellap

Is there an ability to pass deps.json in shared fw scenario?

Running same command without exec does not change anything.

pakrym avatar Mar 25 '16 17:03 pakrym

@pakrym @schellap

The runtimeconfig is not always guaranteed to be next to the deps json, and making this assumption will actually break project tools currently.

Having separate switches seems like the best route to add this extensibility.

brthor avatar Mar 25 '16 17:03 brthor

I had a more detailed look at issue and it goes as follows:

I run muxer:

dotnet.exe 
.nuget\packages\dotnet-test-xunit\1.0.0-dev-91790-12\lib\netstandardapp1.5\dotnet-test-xunit.dll 
--depsfile test\dotnet-compile.Tests\bin\Debug\netstandardapp1.5\win7-x64\dotnet-compile.Tests.deps.json
--additionalprobingpath .nuget\packages 
test\dotnet-compile.Tests\bin\Debug\netstandardapp1.5\dotnet-compile.Tests.dll

muxer fails not being able to find coreclr.dll

Tracing enabled
--- Invoked host main = {
D:\github\dotnet\cli\artifacts\win10-x64\stage2\dotnet.exe
C:\Users\pakrym\.nuget\packages\dotnet-test-xunit\1.0.0-dev-91790-12\lib\netstandardapp1.5\dotnet-test-xunit.dll
--depsfile
D:\github\dotnet\cli\test\dotnet-compile.Tests\bin\Debug\netstandardapp1.5\win7-x64\dotnet-compile.Tests.deps.json
--additionalprobingpath
C:\Users\pakrym\.nuget\packages
D:\github\dotnet\cli\test\dotnet-compile.Tests\bin\Debug\netstandardapp1.5\win7-x64\dotnet-compile.Tests.dll
}
Resolved fxr [D:\github\dotnet\cli\artifacts\win10-x64\stage2\hostfxr.dll]...
Loaded library from D:\github\dotnet\cli\artifacts\win10-x64\stage2\hostfxr.dll
Tracing enabled
Own DLL path=[D:\github\dotnet\cli\artifacts\win10-x64\stage2\dotnet.dll]
Checking if CoreCLR path exists=[D:\github\dotnet\cli\artifacts\win10-x64\stage2\coreclr.dll]
Host operating in Muxer mode
--- Executing in muxer mode...
Runtime config [] is valid=[1]
Executing as a standlone app as per config file []
Could not load host policy library [C:\Users\pakrym\.nuget\packages\dotnet-test-xunit\1.0.0-dev-91790-12\lib\netstandardapp1.5]

deps is standalone and has coreclr entry:

      "runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR/1.0.2-rc2-23924": {
        "runtime": {
          "runtimes/win7-x64/lib/netstandard1.0/mscorlib.dll": {}
        },
        "native": {
          "runtimes/win7-x64/native/clretwrc.dll": {},
          "runtimes/win7-x64/native/coreclr.dll": {},
          "runtimes/win7-x64/native/dbgshim.dll": {},
          "runtimes/win7-x64/native/mscordaccore.dll": {},
          "runtimes/win7-x64/native/mscordbi.dll": {},
          "runtimes/win7-x64/native/mscorlib.ni.dll": {},
          "runtimes/win7-x64/native/mscorrc.debug.dll": {},
          "runtimes/win7-x64/native/mscorrc.dll": {},
          "runtimes/win7-x64/native/sos.dll": {}
        }
      },

pakrym avatar Mar 25 '16 17:03 pakrym

Looping in as we need this for some EF x-plat testing.

Side note: would be nice to be able to invoke dotnet-test on published output, but that probably belongs on a different issue.

natemcmaster avatar Mar 25 '16 18:03 natemcmaster

@brthor, could you please confirm if this is fixed by dotnet/cli#2083?

Full command should be like so:

dotnet.exe exec --depsfile path-to-deps.json --additionalprobingpath probe-path xunit.dll hello.dll

The order is important. Before shared FX we had the below hack that allowed this to work:

dotnet.exe xunit.dll --depsfile path-to-deps.json --additionalprobingpath probe-path hello.dll

I kept this working to help CI from not breaking, so don't use the latter order to specify these params.

schellap avatar Mar 28 '16 07:03 schellap

Any updates?

TheRealPiotrP avatar Mar 31 '16 07:03 TheRealPiotrP

Tested this locally with latest bits:

# cd $RepoRoot/TestAssets/TestProjects/PortableTests/StandaloneApp
# ls
StandaloneApp.deps.json
StandaloneApp.dll
StandaloneApp.pdb
StandaloneApp.runtimeconfig.dev.json
StandaloneApp.runtimeconfig.json

# dotnet exec ./StandaloneApp.dll
Could not load host policy library [.]

I did see libhostpolicy.so in the deps.json file.

brthor avatar Mar 31 '16 07:03 brthor

@brthor How is the above a standalone app when it does not contain libhostfxr and libhostpolicy in it? Also, it appears to be missing ./StandaloneApp.

Who generated this output?

gkhanna79 avatar Apr 01 '16 06:04 gkhanna79

I believe this was the ridless output of build, so this would be an unpublished standalone app.

I didn't specify additionalprobingpath, so let me try that as well.

brthor avatar Apr 01 '16 18:04 brthor

@brthor any update?

gkhanna79 avatar Apr 03 '16 02:04 gkhanna79

I just tested the scenario in Preview3 and did not find a repro.

TheRealPiotrP avatar Nov 10 '16 03:11 TheRealPiotrP