runtime icon indicating copy to clipboard operation
runtime copied to clipboard

dotnet host should provide clearer error messages when app content is missing

Open TheRealPiotrP opened this issue 10 years ago • 14 comments

Steps to reproduce

dotnet new; dotnet build; cp bin/Debug/netcoreapp1.0/hello.dll . dotnet hello.dll

Expected behavior

Error message stating that runtimeconfig.json is missing, or something describing the artifact that is preventing the app from launching.

Actual behavior

library 'libhostpolicy.dylib' required to execute the application was not found

Granted, running an app that wasn't published is not a designed-for scenario. However, since we're printing an error message that points to some symptom, it would be great to specify a more actionable symptom.

This issue is a digest of https://github.com/dotnet/cli/issues/4268 from @kumpera.

TheRealPiotrP avatar Nov 03 '16 08:11 TheRealPiotrP

@ramarag PTAL.

CC @schellap

gkhanna79 avatar Nov 03 '16 14:11 gkhanna79

If runtimeconfig is missing, we default to running a standalone app with dotnet. The next step is to find hostpolicy.dll which is missing.

We could probably detect that this is a standalone invocation using dotnet.exe and print a slightly different message.

But I don't think we should go through the pains of detecting such an invocation just for flagging. We should just modify the error message to say: "Additionally, check if you are doing bad thing."

schellap avatar Nov 03 '16 15:11 schellap

Also, the error message is actually accurate, but it can be more helpful. The artifact that is missing is hostpolicy. Missing runtimeconfig is still a valid app and is also an implementation detail that users should not need to know about.

schellap avatar Nov 03 '16 15:11 schellap

I found this issue today as well, is there any solution? Why do we need the runtime json file?

alexanderuv avatar Feb 17 '17 18:02 alexanderuv

Runtimeconfig.json is required to when building apps that run against Shared FX (i.e. Microsoft.NETCore.App FX). If it is missing, then we expect the app to be standalone and go down that path for activation and any missing components will be raised (as in the message above).

To attempt to run the app, as in the example above, is a user-error since that is not a supported publish/activation model.

gkhanna79 avatar Feb 18 '17 15:02 gkhanna79

@gkhanna79 what is the error message that we should be giving ?

ramarag avatar Mar 29 '17 02:03 ramarag

@ramarag Why don't you suggest an appropriate solution for this :) ?

gkhanna79 avatar Mar 29 '17 14:03 gkhanna79

Can there not be an option in build settings and in back-end to check for it as an embedded resource since it is a required file?

FailMelon avatar Apr 05 '17 14:04 FailMelon

This file is not an embedded resource but a metadata option.

gkhanna79 avatar Apr 05 '17 14:04 gkhanna79

When building either through just a debug build or a published build json file is required for the dll to run, should there not be a way to embed a required file into the app itself? It seems a bit silly to require a json file outside of the app for it to even work.

FailMelon avatar Apr 05 '17 15:04 FailMelon

The metadata will be inserted in .deps.json, which is a build time artifact that is required and generated by the build all the time.

gkhanna79 avatar Apr 05 '17 17:04 gkhanna79

Think you've misunderstood what I've meant i have moved it over to here dotnet/core-setup#1964 since its kind of off topic sorry .

FailMelon avatar Apr 05 '17 18:04 FailMelon

I downloaded an older version of the .NET Core SDK on Mac, because I need to support project.json, but I'm getting this error:

A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in <path>

How can I work around this?

pcgeek86 avatar Apr 17 '17 21:04 pcgeek86

Closing this as dup of https://github.com/dotnet/core-setup/pull/3382

That added the following to the existing error message: Failed to run as a standalone app because there is no '<dir>\<app>.runtimeconfig.json' file. If this should be a portable app instead, add that file specifying the appropriate framework.

steveharter avatar Jan 04 '18 16:01 steveharter