sdk icon indicating copy to clipboard operation
sdk copied to clipboard

dotnet run passing ` --additionalprobingpath` to standalone app

Open pakrym opened this issue 10 years ago • 31 comments

Steps to reproduce

dotnet run standalone app

Expected behavior

It get executed only with arguments passed to dotnet run command

Actual behavior

--additionalprobingpath gets passed to standalone app

xiaota-mac:Microsoft.AspNetCore.Server.Kestrel.GeneratedCode asplab$ ~/.dotnet/dotnet -v run
Project Microsoft.AspNetCore.Server.Kestrel.GeneratedCode (.NETStandardApp,Version=v1.5) was previously compiled. Skipping compilation.
Running /Users/asplab/Documents/buildAgent/work/169923259d6dcfec/Universe/KestrelHttpServer/tools/Microsoft.AspNetCore.Server.Kestrel.GeneratedCode/bin/Debug/netstandardapp1.5/osx.10.10x64/Microsoft.AspNetCore.Server.Kestrel.GeneratedCode --additionalprobingpath /Users/asplab/.nuget/packages
Process ID: 82740
Could not resolve SDK directory from [/Users/asplab/Documents/buildAgent/work/169923259d6dcfec/Universe/KestrelHttpServer/tools/Microsoft.AspNetCore.Server.Kestrel.GeneratedCode/bin/Debg/netstandardapp1.5/osx.10.10-x64]

Environment data

dotnet --version output:

~/.dotnet/dotnet --version
1.0.0-beta-002113

pakrym avatar Mar 29 '16 21:03 pakrym

/cc @piotrpMSFT @davidfowl

pakrym avatar Mar 29 '16 21:03 pakrym

will break any tool that uses dotnet run and arguments

pakrym avatar Mar 29 '16 21:03 pakrym

Why would this break?

Wouldn't additionalProbingPath be used for any packages which can't be found app local? Which is all of them in the dev scenario of standalone apps?

cc @schellap @Sridhar-MS

brthor avatar Mar 29 '16 22:03 brthor

Wouldn't app get additionalProbingPath in args?

pakrym avatar Mar 29 '16 22:03 pakrym

Okay I see, so the ordering of additionalProbingPath is the issue here?

I'm not too clear what the bug is here. That additionalProbingPath is passed at all or that it is passed to the app binary rather than stopped at the host?

brthor avatar Mar 29 '16 22:03 brthor

No, their presence. Lets take Standalone app on windows, which will produce Standalone.exe, corehost in standalone mode should forward app arguments to app itself and now you get additionalProbingPath in public static void Man(string[] args)

pakrym avatar Mar 29 '16 22:03 pakrym

After doing a dotnet build, how could dependencies be resolved without --additionalProbingPath?

@schellap @gkhanna79 we talked about this at length yesterday

brthor avatar Mar 29 '16 22:03 brthor

Via new devruntimecontig.json?

pakrym avatar Mar 29 '16 22:03 pakrym

Sure, the plan is to move additionalProbingPath there, but we still need that information available somehow was the point I was making. I understand what you're saying now.

Can we track this bug in the devruntimeconfig.json bug?

brthor avatar Mar 29 '16 22:03 brthor

now you get additionalProbingPath in public static void Man(string[] args)

This shouldnt happen. The argument is only for the host and not passed to the application.

gkhanna79 avatar Mar 29 '16 22:03 gkhanna79

@gkhanna79 isn't corehost in standalone mode just passing all arguments to manages app without reading/filtering anything?

pakrym avatar Mar 29 '16 22:03 pakrym

dotnet run is using the muxer, not corehost. Not sure if that affects your expectations @pakrym

brthor avatar Mar 29 '16 22:03 brthor

@brthor no, it runs executable directly. https://github.com/dotnet/cli/blob/rel/1.0.0/src/dotnet/commands/dotnet-run/RunCommand.cs#L165

pakrym avatar Mar 29 '16 22:03 pakrym

The fact that you are executing an exe directly is not apparent from your example.

I'm somewhat confused actually, what invocation of dotnet run is failing?

brthor avatar Mar 29 '16 22:03 brthor

dotnet run should be invoking the muxer with --additionalProbingPath. The muxer should be taking data out of --additionalProbingPath and stripping the parameter from the args which get passed along to the app. Like --depsfile, this is an option that is passed to the muxer for its own use and should not get passed along to the app.

@pakrym, is your concern that dotnet.exe is passing along the --additionalprobingpath` to the muxer? Or you're concerned about this due to inspection of the invocation site?

TheRealPiotrP avatar Mar 30 '16 00:03 TheRealPiotrP

ping

TheRealPiotrP avatar Mar 31 '16 06:03 TheRealPiotrP

First, it looks like the standalone app.exe is run with --additionalprobingpath and not using the muxer.

/Users/asplab/Documents/buildAgent/work/169923259d6dcfec/Universe/KestrelHttpServer/tools/Microsoft.AspNetCore.Server.Kestrel.GeneratedCode/bin/Debug/netstandardapp1.5/osx.10.10x64/Microsoft.AspNetCore.Server.Kestrel.GeneratedCode --additionalprobingpath /Users/asplab/.nuget/packages

schellap avatar Mar 31 '16 09:03 schellap

That's expected right? It is standalone...

davidfowl avatar Mar 31 '16 09:03 davidfowl

@gkhanna79 had it clear in his spec that --additionalprobingpath is only for dev scenarios and the muxer will be used to activate the build dll using the dotnet exec keyword.

Why would you expect it to be standalone when it isn't published yet, with its dependencies next to it?

schellap avatar Mar 31 '16 09:03 schellap

Secondly, how and why did you get the native app.exe if you just did build? Isn't build supposed to just produce the entry.dll and its project dependency dlls?

schellap avatar Mar 31 '16 09:03 schellap