dotnet-host-build compilation throwing NullReferenceException
Steps to reproduce
- Clone my fork of core-setup.
- Run
build_projects/dotnet-host-build/build.sh --build-driver-only.
Expected behavior
dotnet-host-build should compile.
Actual behavior
When dotnet-host-build is compiled, dotnet compile-csc fails with no output other than "Object reference not set to an instance of an object."
Environment data
This is the output from the copy of dotnet downloaded by the core-setup build script, and not the one I use for all other tasks. This old copy is being used mostly because it still supports project.json, which dotnet-host-build uses.
.NET Command Line Tools (1.0.0-preview3-003886)
Product Information:
Version: 1.0.0-preview3-003886
Commit SHA-1 hash: 4b0c2f5ebe
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.12
OS Platform: Darwin
RID: osx.10.11-x64
Note: I am using a fork of core-setup because I am integrating it into a (closed-source) script that builds all of .NET Core from source. Some patches were already required to make core-setup interact correctly with this script, and those patches would not be acceptable pushed to upstream. (However, if a patch is suitable to merged with upstream, such as the one in dotnet/core-setup#1458, I will readily open a PR.)
@jyoungyun Can you please take a look at this as you helped add the support for this switch?
CC @hqueue
@gkhanna79 This happens whether or not the --build-driver-only switch is passed; I simply included it because the running of dotnet-host-build is not relevant to the bug I am reporting.
@gkhanna79 I think this issue is not related to --build-driver-only switch.
@wjk According to your error log, the error occured during the dotnet restore process (https://github.com/dotnet/core-setup/blob/master/build_projects/dotnet-host-build/build.sh#L165) , and you should check if your environment is capable of dotnet restore.
In that case, I have noticed that it happens if you have not done a clean build. If you do "git clean -xdf" and then reattempt the build, you should not see it.
@wjk I also sometimes faced the same exception and use git clean -xdf to resolve the exception. Just make sure backup any unstaged changes before clean.
Yep, git clean -xdf solved it for me. I'm going to close this issue now. Thanks!