driver should provide actionable error message when entry point is missing
Steps to reproduce
I wanted to create an app but by mistake use the netstandard1.5 moniker instead of netcoreapp1.0 - like this:
{
"compilationOptions": {
"emitEntryPoint": true,
"debugType": "portable"
},
"dependencies" : {
"NETStandard.Library": "1.5.0-*"
},
"frameworks": {
"netstandard1.5": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50"
]
}
}
}
do:
dotnet run
Expected behavior
An error saying my application is not an app but a dll
Actual behavior
PS C:\Users\\Documents\Visual Studio 2015\Projects\dotnet-scratch> dotnet run
Project dotnet-scratch (.NETStandard,Version=v1.5) was previously compiled. Skipping compilation.
Could not load host policy library from [C:\Users\\Documents\Visual Studio 2015\Projects\dotnet-scratch\bin\Debug\netstandard1.5]
Environment data
dotnet --info output:
``
dotnet --version
1.0.0-rc2-002416
@moozzyk the first part of the expected behavior makes sense. I'm not clear on how we achieve the second, however. I don't think that hard-coding TFMs is a scalable idea, and I don't know of a mechanism for describing the intended purpose of the various TFMs.
Can you split this into two bugs? Let's try to fix the obvious one soon, but the tfm one will take more thought.
Assigning to schellap for "no entrypoint" fix. @moozzyk please create the second bug only for "this is not the right framework".
@piotrpMSFT - I will create a new bug.
I think I might have been to specific with the solution. In general the error should make it clear what is wrong and I can fix that.
@piotrpMSFT - you changed the title but the new title does not reflect the scenario. I did have "emitEntryPoint": true in my app - and you can see it in the project.json file I included.
@piotrpMSFT dotnet run should detect if entryPoint is set to false. Or we have to plumb this into the host from project.json into runtimeconfig. @gkhanna79
The host should not be in the business of validating configurations. If it is invoked, it should look for the data it requires for activating the application and work with it.
In this scenario, @moozzyk says emitEntrypoint was specified to true but @piotrpMSFT you say otherwise. Which is it?
@gkhanna79 emitEntryPoint was set to true from the very beginning and until I changed the tfm to netcoreapp1.0 (or netstandardapp1.5) dotnet run fell flat on the face with the Could not load host policy library from....
In general I think none of the messages returned by the host should reach the user in the form they are now or without more explanation. The only thing a user can do when they see: Invalid deps file, Could not load host policy library from... etc. is just stare...
I think none of the messages returned by the host should reach the user
This is why "dotnet run" implementation should account for pre-conditions to be valid before invoking the host.
@piotrpMSFT I am assigning this to you to reroute this as appropriate.
An appropriate error message here would be:
Expected host artifacts to be present in C:\foo\bar. This may be because of an invalid configuration.
@moozzyk, the host needs a libhostpolicy.so to run the app, but dotnet build optimizes away copying host artifacts when emitEntryPoint is false. Would the above error message be useful to you?
See: https://github.com/dotnet/cli/blob/852446e859108c0f8e9e61c195dccda77a1a1886/src/Microsoft.DotNet.Compiler.Common/Executable.cs#L81
@schellap - emitEntryPoint was true - see the project.json.
Expected host artifacts to be present
This is an internal implementation detail that does not make sense to the user. We should say something generic but user-consumable like "Invalid .NET Core FX configuration".
Fixed in RC3