runtime icon indicating copy to clipboard operation
runtime copied to clipboard

dotnet-host-build compilation throwing NullReferenceException

Open wjk opened this issue 9 years ago • 7 comments

Steps to reproduce

  1. Clone my fork of core-setup.
  2. 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

wjk avatar Feb 06 '17 01:02 wjk

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.)

wjk avatar Feb 06 '17 01:02 wjk

@jyoungyun Can you please take a look at this as you helped add the support for this switch?

CC @hqueue

gkhanna79 avatar Feb 06 '17 03:02 gkhanna79

@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.

wjk avatar Feb 06 '17 04:02 wjk

@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.

jyoungyun avatar Feb 06 '17 04:02 jyoungyun

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.

gkhanna79 avatar Feb 06 '17 05:02 gkhanna79

@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.

hqueue avatar Feb 06 '17 07:02 hqueue

Yep, git clean -xdf solved it for me. I'm going to close this issue now. Thanks!

wjk avatar Feb 06 '17 13:02 wjk