dotnet run app.dll throws null reference exception
See original GitHub issueSteps to reproduce
- build a console app.
- run dotnet publish
- navigate to the publish folder
- run dotnet run app.dll
Expected behavior
An error indicating that to use dotnet on a dll you shoud do dotne app.dll
Actual behavior
Object reference not set to an instance of an object.
Environment data
dotnet --info
output:
.NET Command Line Tools (1.0.0-rc2-002611)
Product Information: Version: 1.0.0-rc2-002611 Commit Sha: bf8f0edd89
Runtime Environment: OS Name: ubuntu OS Version: 14.04 OS Platform: Linux RID: ubuntu.14.04-x64
Other info “dependencies”: { “Microsoft.NETCore.App”: { “version”: “1.0.0-rc2-24008”, “type”: “platform” }, “Microsoft.AspNetCore.Server.IISIntegration”: “1.0.0-rc2-20581”, “Microsoft.AspNetCore.Server.Kestrel”: “1.0.0-rc2-20581” },
“frameworks”: { “netcoreapp1.0”: { “imports”: [ “dotnet5.6”, “dnxcore50”, “portable-net45+win8” ] } }
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Getting a NullReferenceException when using dotnet run
In most cases code that throws a NullReferenceException has a bug. It assumed something was not null when in fact it was null....
Read more >How can I fix the error: System.NullReferenceException
A NullReferenceException exception is thrown when you try to access a member on a type whose value is null. A NullReferenceException exception ...
Read more >Object Reference Not Set to an Instance of an Object
This exception is thrown when you try to access a member—for instance, a method or a property—on a variable that currently holds a...
Read more >Issues with System.NullReferenceException occurrence ...
NET Core 3.1 is breaking when starting the web application because of a NullReferenceException, but this one is thrown in the IISHttpServer.
Read more >Debugging System.NullReferenceException - elmah.io Blog
The exception happens when you try to invoke a reference that you were expecting to point to an object but in fact, points...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Perhaps this can be clarified in documentation. I was trying to run my published app using
dotnet run
, only to find out now it should be run usingdotnet filename.dll
. Never mind, it shouldn’t crash with such a vague error message. I haven’t tried the preview2 bits yet though.This has been added to the documentation now (e.g. https://docs.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-run). Closing. Since the issue is by design, if the docs need more clarification, feel free to open the issue on dotnet/docs repo.