-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitVersionTask 5.1.1: object reference not set to an instance of object. #1876
Comments
I do get the same when using GitVersionTask from within a .NET core 3 container(debian based). The log shows:
Same project outside the container just works fine (i.e. native on Windows 10). |
I can confirm that 5.1.1 MSBuild task does not work and throws an NRE whenever I attempt to use it on AzDO Pipelines. Downgrading to 5.0.1 works. |
@Bit-Chaos, your log contains the warning In order to fix any of these problems, it would greatly help if you could help produce a stack trace from a debug build of GitVersion so we could get all frames including line numbers. |
Currently we do not support debian 10 as the Libgi2sharp.native libraries which we rely on, do not support it yet. So you could use the debian 9 docker image. I will try to find a way to build ourselves the dependencies |
@asbjornu How could I produce logs from Pipelines? We're using the MSBuild task and the only error I get is |
@arturcic When I do use the bionic-image of .NET 3 (mcr.microsoft.com/dotnet/core/sdk:3.0-bionic = Ubuntu 18.04 LTS) instead of the default one (FROM mcr.microsoft.com/dotnet/core/sdk:3.0=debian 10), then the error "Object reference not set to an instance of an object" disappears, but then I do get a new error: One can easily recreate the problem by creating a container-based C# project, adding GitVersionTask as a reference and then trying to (re-)load the project in OmniSharp. Strangely enough the command-line tools do work, i.e. dotnet restore/build/etc. So it seems to be a combination of GitVersionTask and Omnisharp inside a docker-container. Using the combination natively on the host works without problems. |
@Bit-Chaos , could you create a github repo with a sample of how to reproduce it and the steps, so that we can check it? |
@arturcic , I just uploaded a test-project to: "https://github.com/Bit-Chaos/GitVersionTask". Once you open the project inside a container using VSCode, you'll get the error when the project is loaded for inspection from Omnisharp. You can recreate the error message every time you try to reload the project (i.e. Ctrl-Shift-P -> "Omnisharp: select project". This project uses the default 3.0 container with debian 10, if you also need a container using Ubuntu, then you'll just have to change the line |
@Bit-Chaos I have tried the test project you've created and I got the
|
@arturcic , Hi Artur ` OmniSharp server started. Starting OmniSharp on ubuntu 18.4 (x64) Attempted to update project that is not loaded: /workspaces/GitVersionTask/aspnetapp.csproj |
It seems you don't have a specific encoding installed, I guess in the docker container? or it's on the host? |
This is all inside the docker container. Just using vanilla image from Microsoft... |
I also use the exact same image, and it works for me. That means the issue is on the host somehow, not on the container. |
That would be be strange, since the container is supposed to be identical wherever it runs. What kind of host environment are you using? |
|
`~/source/repos/dotnet/GitVersionTask [master ≡]> docker info Server: |
as far as I can see your host is Fedora 30? |
That's correct, but I also get the same result when I do run the container on a Windows 10 Professional host. |
I see. To be honest I don't know how to continue the investigation |
Can you build a version which has a lot of tracing activated which I could run inside the container? I could also look into building the package, but it would be probably faster if you could simply a version having the environment already set up.. |
Have you tried to dotnet restore/build from commandline ? |
Are you referring to the repository above? If yes, then this works without problems. It seems just to be a problem in combination with Omni-sharp inside the container. The same repository outside the container has no problems, i.e. doing everything native, does not show the problem. So it might very well be something related to the environment inside the container. |
got you, Unfortunately I don't have much time today to have a look, Hopefully I can find some this week |
Thanks a lot for you effort!!! |
FWIW, I'm getting a similar error, but for 1 of 3 (or, suddently the other 2 projects) when building on Azure Devops. All three work locally. I forked GitHub with the intention to build a package with symbols to see where this happens but the build script failed with an error in the teardown action (log here: https://pastebin.com/3BrfkpiK) Maybe it's related to using .net core 2.2 in my case though? Love Gitversion though! Thanks for an awesome tool! Update: Backing up to 5.0.1 fixed the Azure Devops build for me as well. |
any pointers on how to get a the stack traces? I attempted to build a debug build but still not getting any stack traces. |
I'm not sure, but we might have the stack trace we need in #1885. It would at least be interesting to see whether fixing that also fixes the problems reported here. |
This code seems to be the troubled area: GitVersion/src/GitVersionCore/GitPreparer.cs Lines 21 to 31 in abc4999
This seems most reasonable that Safest bet is to change to WorkingDirectory = arguments.TargetPath?.TrimEnd('/', '\\'); |
@Casz can you check the latest beta when it's indexed and say if it was fixed? |
version 5.1.2-beta.1+8 |
Will do! 🎢 |
Still fails on Travis: https://travis-ci.org/nmklotas/GitLabApiClient/builds/607898645#L285 Passes on AppVeyor https://ci.appveyor.com/project/nmklotas/gitlabapiclient/builds/28641887 |
Travis failed due to shallow clone, so 👍 Adding this to your git:
depth: false |
Testing our Jenkins instance for good measure 😄 |
Fails with 5.1.1, downgrading to 5.0.1 works.
GitVersionTask.targets(56,9): error : Object reference not set to an instance of an object.
When building this csproj
The text was updated successfully, but these errors were encountered: