sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Crash when "emitEntryPoint": true is not present in project.json

Open Petermarcu opened this issue 10 years ago • 6 comments

Steps to reproduce

dotnet new remove "emitEntryPoint": true dotnet run

Expected behavior

App should be able to run with a default setting

Actual behavior

App crashes:

[Window Title] dotnet.exe

[Main Instruction] dotnet.exe has stopped working

[Content] A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.

[Debug] [Close program]

Unhandled Exception: System.MissingMethodException: Entry point not found in assembly 'App1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Environment data

1.0.0-beta-002071

Petermarcu avatar Mar 28 '16 23:03 Petermarcu

Isn't this how it should be? Now, the error message / behavior should probably be better, something like: The project cannot be run, it has no entry point, but still.

I always assume these "options" parameters to be false unless otherwise specified. So I would assume that not specifying "emitEntryPoint" would make the default value "false", i.e. create a DLL with no .entrypoint method. That might be a bad assumption.

mellinoe avatar Mar 28 '16 23:03 mellinoe

I agree with @mellinoe. Removing the emit entry point option turns the assembly into a library. Running it should not succeed. That said, we should provide a much better UX.

@schellap, I assume this is easy to catch and handle in dotnet.exe? I'd augment the error a bit to {path to dll} cannot be run, it has no entry point

TheRealPiotrP avatar Mar 31 '16 07:03 TheRealPiotrP

The native host has no such idea since presence of managed entrypoint is done by the runtime. If this needs to be reported better, it will be good to have a hint in app.deps.json (or such) to indicate if this is an app or not.

gkhanna79 avatar Apr 01 '16 05:04 gkhanna79

This seems like the expected outcome. The host is not in control of handling these errors/exceptions from the runtime. @gkhanna79 is this something worth bubbling up from the runtime for managed exceptions that will pop a WER dialog? If that will not make a CoreCLR RTM bar, we should just close this out.

schellap avatar Apr 18 '16 09:04 schellap

This is the runtime exception bubbled up - it went unhandled and the OS configuration on the machine resulted in Watson. The host is not in the business of examining the implementation of the assembly.

@Petermarcu Are you expecting that something will check the binary is not an EXE and abort? If so, that should be "dotnet run" implementation that invokes "dotnet <pathtoapp.dll" after "dotnet build". This is not a host issue.

gkhanna79 avatar Apr 18 '16 14:04 gkhanna79

So, this error doesn't exist anymore in the latest bits. dotnet run returns the following information:

Unable to run your project.
Please ensure you have a runnable project type and ensure 'dotnet run' supports this project.
The current OutputType is 'Library'.

With this, I will close this issue since I don't really see how the CLI could do anything better here.

thesmithee avatar Nov 10 '16 13:11 thesmithee