dotnet run ./path/to/project throws Object reference not set to an instance of an object.
Steps to reproduce
Steps fail on both Windows or OSX
clone https://github.com/NotMyself/coreapp
cd coreapp & dotnet restore
dotnet run ./src/UIMvc
dotnet test ./test/UIMvc.Tests
Expected behavior
web project should compile and run test project should compile and run
Actual behavior
web project throws Error: Object not set to an instance of an object. test project runs as expected
Environment data
dotnet --info output:
OSX via iTerm bash .NET Command Line Tools (1.0.0-preview1-002702)
Product Information: Version: 1.0.0-preview1-002702 Commit Sha: 6cde21225e
Runtime Environment: OS Name: Mac OS X OS Version: 10.11 OS Platform: Darwin RID: osx.10.11-x64
Windows via PowerShell .NET Command Line Tools (1.0.0-preview1-002702)
Product Information: Version: 1.0.0-preview1-002702 Commit Sha: 6cde21225e
Runtime Environment: OS Name: Windows OS Version: 10.0.14342 OS Platform: Windows RID: win10-x64
@NotMyself just one item, did you point to a directory with a project.json or to the project.json explictly?
To a directory with a project.json. You should be able to repro from the git repo posted.
using dotnet run -p ./src/UIMvc should work, but this error message should really clarify that you need the -p.
In general, I don't think we should throw exceptions. :smile:
@degrim that seems inconsistent with the test command shouldn't they both require the -r?
dotnet test -r should specify the runtime to use, according to dotnet test --help:
-r | --runtime <RUNTIME_IDENTIFIER> Look for test binaries for a for the specified runtime
bleh, I meant to say -p not -r
I agree that seems inconsistent.
Right now, dotnet run is actually the only command that requires the -p when specifying the project.json.
I would argue that instead of simply adding that to dotnet test, we should take a look and see if we can make all the built-in commands for the CLI consistent on how they take a path to the project.json.
We just need to keep in mind that dotnet test/run are special because they also pass arguments down to an underlying app. Run to the app itself and test to the runner.
I particularly prefer the clean way of not having to add the -p, but then, how would we discern a path to project.json passed to run versus one passed to the app?
@blackdwarf can you take a stab at the best design here?
cc @eerhardt
Ofc. The discern could happen with a special token, e.g. -- or something like that, that would indicate others are to be passed down. Just a though.
FWIW this was fixed by dotnet/cli#2969 and and dotnet/cli#2980.
Closing per @vcsjones comment above.