Skip to content
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

Closed
jetersen opened this issue Oct 30, 2019 · 35 comments · Fixed by #1887
Closed

GitVersionTask 5.1.1: object reference not set to an instance of object. #1876

jetersen opened this issue Oct 30, 2019 · 35 comments · Fixed by #1887
Labels
Milestone

Comments

@jetersen
Copy link
Contributor

jetersen commented Oct 30, 2019

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

<Project Sdk="Microsoft.Build.NoTargets/1.0.85">

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <IncludeBuildOutput>false</IncludeBuildOutput>
    <UpdateAssemblyInfo>false</UpdateAssemblyInfo>
    <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
  </PropertyGroup>

  <PropertyGroup>
    <developmentDependency>true</developmentDependency>
    <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="build\*">
      <PackagePath>build\</PackagePath>
    </Content>
    <Content Include="buildMultiTargeting\*">
      <PackagePath>buildMultiTargeting\</PackagePath>
    </Content>
    <Content Include="tools\**">
      <PackagePath>tools\</PackagePath>
    </Content>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="GitVersionTask" Version="5.1.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
    </PackageReference>
  </ItemGroup>

</Project>
@Bit-Chaos
Copy link

Bit-Chaos commented Oct 31, 2019

I do get the same when using GitVersionTask from within a .NET core 3 container(debian based). The log shows:

/home/vscode/.nuget/packages/gitversiontask/5.1.1/build/GitVersionTask.targets(16,9): Error: Object reference not set to an instance of an object
Project gets loaded from VSCode and the Omnisharp-plugin fails to load the project because of GitVersionTask.
Using version 5.0.1 I do get the following stack-trace:
[warn]: OmniSharp.MSBuild.ProjectLoader
        WARN [10/31/19 7:21:51:99] Could not determine assembly version: System.BadImageFormatException: Method has no body
File name: 'LibGit2Sharp'
  at LibGit2Sharp.Core.Proxy.git_buf_dispose (LibGit2Sharp.Core.Handles.GitBuf buf) [0x00000] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Core.Handles.GitBuf.Dispose () [0x00000] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Core.Proxy.ConvertPath (System.Func`2[T,TResult] pathRetriever) [0x0002e] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Core.Proxy.git_repository_discover (LibGit2Sharp.Core.FilePath start_path) [0x00005] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Repository.Discover (System.String startingPath) [0x00006] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at GitVersion.GitPreparer.GetDotGitDirectory () [0x0000f] in <5ef86c5c4a534bc2b5e01192000f40c0>:0 
  at GitVersion.ExecuteCore.ExecuteGitVersion (System.String targetUrl, System.String dynamicRepositoryLocation, GitVersion.Authentication authentication, System.String targetBranch, System.Boolean noFetch, System.String workingDirectory, System.String commitId, GitVersion.Config overrideConfig, System.Boolean noCache) [0x00054] in <5ef86c5c4a534bc2b5e01192000f40c0>:0 
  at GitVersion.ExecuteCore.TryGetVersion (System.String directory, GitVersion.VersionVariables& versionVariables, System.Boolean noFetch, GitVersion.Authentication authentication) [0x00000] in <5ef86c5c4a534bc2b5e01192000f40c0>:0 
[warn]: OmniSharp.MSBuild.ProjectLoader
        WARN [10/31/19 7:21:52:02] Could not determine assembly version: System.BadImageFormatException: Method has no body
File name: 'LibGit2Sharp'
  at LibGit2Sharp.Core.Proxy.git_buf_dispose (LibGit2Sharp.Core.Handles.GitBuf buf) [0x00000] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Core.Handles.GitBuf.Dispose () [0x00000] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Core.Proxy.ConvertPath (System.Func`2[T,TResult] pathRetriever) [0x0002e] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Core.Proxy.git_repository_discover (LibGit2Sharp.Core.FilePath start_path) [0x00005] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Repository.Discover (System.String startingPath) [0x00006] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at GitVersion.GitPreparer.GetDotGitDirectory () [0x0000f] in <5ef86c5c4a534bc2b5e01192000f40c0>:0 
  at GitVersion.ExecuteCore.ExecuteGitVersion (System.String targetUrl, System.String dynamicRepositoryLocation, GitVersion.Authentication authentication, System.String targetBranch, System.Boolean noFetch, System.String workingDirectory, System.String commitId, GitVersion.Config overrideConfig, System.Boolean noCache) [0x00054] in <5ef86c5c4a534bc2b5e01192000f40c0>:0 
  at GitVersion.ExecuteCore.TryGetVersion (System.String directory, GitVersion.VersionVariables& versionVariables, System.Boolean noFetch, GitVersion.Authentication authentication) [0x00000] in <5ef86c5c4a534bc2b5e01192000f40c0>:0 

Same project outside the container just works fine (i.e. native on Windows 10).
After a bit of investigation it seems that this is a result native-libraries not having all the required dependencies installed. The used docker-image uses debian-10, but the GitVersionTask only provides debian.9. So I assume, that it falls back to linux-64, which then has unresolved dependencies

@patrickklaeren
Copy link

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.

@asbjornu
Copy link
Member

@Bit-Chaos, your log contains the warning Could not determine assembly version: System.BadImageFormatException: Method has no body, which seems to be different from @Casz's problem which is a NullReferenceException?

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.

@arturcic
Copy link
Member

arturcic commented Nov 1, 2019

I do get the same when using GitVersionTask from within a .NET core 3 container(debian based). The log shows:

/home/vscode/.nuget/packages/gitversiontask/5.1.1/build/GitVersionTask.targets(16,9): Error: Object reference not set to an instance of an object
Project gets loaded from VSCode and the Omnisharp-plugin fails to load the project because of GitVersionTask.
Using version 5.0.1 I do get the following stack-trace:
[warn]: OmniSharp.MSBuild.ProjectLoader
        WARN [10/31/19 7:21:51:99] Could not determine assembly version: System.BadImageFormatException: Method has no body
File name: 'LibGit2Sharp'
  at LibGit2Sharp.Core.Proxy.git_buf_dispose (LibGit2Sharp.Core.Handles.GitBuf buf) [0x00000] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Core.Handles.GitBuf.Dispose () [0x00000] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Core.Proxy.ConvertPath (System.Func`2[T,TResult] pathRetriever) [0x0002e] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Core.Proxy.git_repository_discover (LibGit2Sharp.Core.FilePath start_path) [0x00005] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Repository.Discover (System.String startingPath) [0x00006] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at GitVersion.GitPreparer.GetDotGitDirectory () [0x0000f] in <5ef86c5c4a534bc2b5e01192000f40c0>:0 
  at GitVersion.ExecuteCore.ExecuteGitVersion (System.String targetUrl, System.String dynamicRepositoryLocation, GitVersion.Authentication authentication, System.String targetBranch, System.Boolean noFetch, System.String workingDirectory, System.String commitId, GitVersion.Config overrideConfig, System.Boolean noCache) [0x00054] in <5ef86c5c4a534bc2b5e01192000f40c0>:0 
  at GitVersion.ExecuteCore.TryGetVersion (System.String directory, GitVersion.VersionVariables& versionVariables, System.Boolean noFetch, GitVersion.Authentication authentication) [0x00000] in <5ef86c5c4a534bc2b5e01192000f40c0>:0 
[warn]: OmniSharp.MSBuild.ProjectLoader
        WARN [10/31/19 7:21:52:02] Could not determine assembly version: System.BadImageFormatException: Method has no body
File name: 'LibGit2Sharp'
  at LibGit2Sharp.Core.Proxy.git_buf_dispose (LibGit2Sharp.Core.Handles.GitBuf buf) [0x00000] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Core.Handles.GitBuf.Dispose () [0x00000] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Core.Proxy.ConvertPath (System.Func`2[T,TResult] pathRetriever) [0x0002e] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Core.Proxy.git_repository_discover (LibGit2Sharp.Core.FilePath start_path) [0x00005] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at LibGit2Sharp.Repository.Discover (System.String startingPath) [0x00006] in <5e2d125af12e4bcc982f89d05fe51418>:0 
  at GitVersion.GitPreparer.GetDotGitDirectory () [0x0000f] in <5ef86c5c4a534bc2b5e01192000f40c0>:0 
  at GitVersion.ExecuteCore.ExecuteGitVersion (System.String targetUrl, System.String dynamicRepositoryLocation, GitVersion.Authentication authentication, System.String targetBranch, System.Boolean noFetch, System.String workingDirectory, System.String commitId, GitVersion.Config overrideConfig, System.Boolean noCache) [0x00054] in <5ef86c5c4a534bc2b5e01192000f40c0>:0 
  at GitVersion.ExecuteCore.TryGetVersion (System.String directory, GitVersion.VersionVariables& versionVariables, System.Boolean noFetch, GitVersion.Authentication authentication) [0x00000] in <5ef86c5c4a534bc2b5e01192000f40c0>:0 

Same project outside the container just works fine (i.e. native on Windows 10).
After a bit of investigation it seems that this is a result native-libraries not having all the required dependencies installed. The used docker-image uses debian-10, but the GitVersionTask only provides debian.9. So I assume, that it falls back to linux-64, which then has unresolved dependencies

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

@patrickklaeren
Copy link

@asbjornu How could I produce logs from Pipelines? We're using the MSBuild task and the only error I get is Object reference not set to an instance of an object with no other indicator as to what it wrong. The exact same repo and config works when downgrading from 5.1.1 to 5.0.1

@Bit-Chaos
Copy link

@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:
/home/vscode/.nuget/packages/gitversiontask/5.1.1/build/GitVersionTask.targets(16,9): Error: Encoding 37 data could not be found. Make sure you have correct international codeset assembly installed and enabled.

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.

@arturcic
Copy link
Member

arturcic commented Nov 2, 2019

@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 arturcic added the bug label Nov 2, 2019
@Bit-Chaos
Copy link

@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
FROM mcr.microsoft.com/dotnet/core/sdk:3.0
into
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-bionic
This will result in a different error. So probably it has something to do with the libgit2sharp library (but that's just guessing from my side)

@arturcic
Copy link
Member

arturcic commented Nov 3, 2019

@Bit-Chaos I have tried the test project you've created and I got the Object reference not set to an instance of an object error. I have also tried the bionic image as you suggested, but it worked perfectly, no errors on my side. So the first error is because of the debian 10 image, that we currently do not support. Using bionic image works.

Starting OmniSharp server at 11/3/2019, 6:27:33 PM
    Target: /workspaces/GitVersionTask

OmniSharp server started.
    Path: /home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/run
    PID: 503

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on ubuntu 18.4 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 16.0 - "/home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 16.0 - "/home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/omnisharp/.msbuild/Current/Bin"
            MSBuildExtensionsPath = /home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/omnisharp/.msbuild
            BypassFrameworkInstallChecks = true
            CscToolPath = /home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/omnisharp/.msbuild/Current/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/omnisharp/.msbuild/Current/Bin
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/workspaces/GitVersionTask'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in '/workspaces/GitVersionTask'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/workspaces/GitVersionTask/aspnetapp.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/workspaces/GitVersionTask'.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /workspaces/GitVersionTask/aspnetapp.csproj
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/workspaces/GitVersionTask' on host 313.
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/workspaces/GitVersionTask/aspnetapp.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/workspaces/GitVersionTask/aspnetapp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: aspnetapp

@Bit-Chaos
Copy link

@arturcic , Hi Artur
when I do load the project with the bionic-image (FROM mcr.microsoft.com/dotnet/core/sdk:3.0-bionic) I do get the following message:

`
Starting OmniSharp server at 11/3/2019, 7:02:21 PM
Target: /workspaces/GitVersionTask

OmniSharp server started.
Path: /home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/run
PID: 891

Starting OmniSharp on ubuntu 18.4 (x64)
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.0 - "/home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/omnisharp/.msbuild/Current/Bin"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.0 - "/home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/omnisharp/.msbuild/Current/Bin"
MSBuildExtensionsPath = /home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/omnisharp/.msbuild
BypassFrameworkInstallChecks = true
CscToolPath = /home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/omnisharp/.msbuild/Current/Bin/Roslyn
CscToolExe = csc.exe
MSBuildToolsPath = /home/vscode/.vscode-server/extensions/ms-vscode.csharp-1.21.5/.omnisharp/1.34.5/omnisharp/.msbuild/Current/Bin
info: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/workspaces/GitVersionTask'.
info: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
info: OmniSharp.MSBuild.ProjectSystem
No solution files found in '/workspaces/GitVersionTask'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for '/workspaces/GitVersionTask/aspnetapp.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/workspaces/GitVersionTask'.
info: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
info: OmniSharp.MSBuild.ProjectManager
Loading project: /workspaces/GitVersionTask/aspnetapp.csproj
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
info: OmniSharp.WorkspaceInitializer
Configuration finished.
info: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/workspaces/GitVersionTask' on host 212.
fail: OmniSharp.MSBuild.ProjectLoader
Encoding 37 data could not be found. Make sure you have correct international codeset assembly installed and enabled.
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file '/workspaces/GitVersionTask/aspnetapp.csproj'.
/workspaces/GitVersionTask/aspnetapp.csproj
/home/vscode/.nuget/packages/gitversiontask/5.1.1/build/GitVersionTask.targets(16,9): Error: Encoding 37 data could not be found. Make sure you have correct international codeset assembly installed and enabled.

Attempted to update project that is not loaded: /workspaces/GitVersionTask/aspnetapp.csproj
info: OmniSharp.OmniSharpWorkspace
Miscellaneous file: /workspaces/GitVersionTask/obj/Debug/netcoreapp3.0/AssemblyInfo_aspnetapp_bgjp8d6f.mzi.g.cs added to workspace
`
So the error changes from "object refernce" to "/home/vscode/.nuget/packages/gitversiontask/5.1.1/build/GitVersionTask.targets(16,9): Error: Encoding 37 data could not be found. Make sure you have correct international codeset assembly installed and enabled.".

@arturcic
Copy link
Member

arturcic commented Nov 3, 2019

It seems you don't have a specific encoding installed, I guess in the docker container? or it's on the host?

@Bit-Chaos
Copy link

Bit-Chaos commented Nov 3, 2019

This is all inside the docker container. Just using vanilla image from Microsoft...

@arturcic
Copy link
Member

arturcic commented Nov 3, 2019

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.

@Bit-Chaos
Copy link

That would be be strange, since the container is supposed to be identical wherever it runs. What kind of host environment are you using?

@arturcic
Copy link
Member

arturcic commented Nov 3, 2019

Client: Docker Engine - Community
 Version:           19.03.4
 API version:       1.40
 Go version:        go1.12.10
 Git commit:        9013bf5
 Built:             Thu Oct 17 23:44:48 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.4
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.10
  Git commit:       9013bf5
  Built:            Thu Oct 17 23:50:38 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

@Bit-Chaos
Copy link

`~/source/repos/dotnet/GitVersionTask [master ≡]> docker info
Client:
Debug Mode: false

Server:
Containers: 2
Running: 1
Paused: 0
Stopped: 1
Images: 21
Server Version: 19.03.4
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 5.3.7-200.fc30.x86_64
Operating System: Fedora 30 (Workstation Edition)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 11.66GiB
Name: voyager
ID: LW7Z:EQO3:HLIE:G2LE:P2HZ:IRPT:22R3:LFHU:E5YS:K56Y:GNMZ:26LP
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
`

@arturcic
Copy link
Member

arturcic commented Nov 3, 2019

as far as I can see your host is Fedora 30?

@Bit-Chaos
Copy link

That's correct, but I also get the same result when I do run the container on a Windows 10 Professional host.

@arturcic
Copy link
Member

arturcic commented Nov 3, 2019

I see. To be honest I don't know how to continue the investigation

@Bit-Chaos
Copy link

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

@arturcic
Copy link
Member

arturcic commented Nov 3, 2019

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 ?

@Bit-Chaos
Copy link

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.

@arturcic
Copy link
Member

arturcic commented Nov 3, 2019

got you, Unfortunately I don't have much time today to have a look, Hopefully I can find some this week

@Bit-Chaos
Copy link

Thanks a lot for you effort!!!

@marcus-sonestedt
Copy link

marcus-sonestedt commented Nov 4, 2019

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.

@jetersen
Copy link
Contributor Author

jetersen commented Nov 4, 2019

any pointers on how to get a the stack traces? I attempted to build a debug build but still not getting any stack traces.

@asbjornu
Copy link
Member

asbjornu commented Nov 5, 2019

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.

@jetersen
Copy link
Contributor Author

jetersen commented Nov 5, 2019

So it was the addition to dependency injection that is causing the issue, that seems reasonable it was also recently added.
#1861
#1865

Any chance we can fix these @arturcic ?

@jetersen
Copy link
Contributor Author

jetersen commented Nov 5, 2019

This code seems to be the troubled area:

public GitPreparer(ILog log, IEnvironment environment, IOptions<Arguments> options)
{
this.log = log ?? throw new ArgumentNullException(nameof(log));
this.environment = environment;
arguments = options.Value;
TargetUrl = arguments.TargetUrl;
WorkingDirectory = arguments.TargetPath.TrimEnd('/', '\\');
dynamicRepositoryLocation = arguments.DynamicRepositoryLocation;
}

WorkingDirectory = arguments.TargetPath.TrimEnd('/', '\\');

This seems most reasonable that TrimEnd is one throwing null pointer exception as TargetPath is most likely null.

Safest bet is to change to

WorkingDirectory = arguments.TargetPath?.TrimEnd('/', '\\');

@arturcic
Copy link
Member

arturcic commented Nov 5, 2019

@Casz can you check the latest beta when it's indexed and say if it was fixed?

@arturcic
Copy link
Member

arturcic commented Nov 5, 2019

version 5.1.2-beta.1+8

@jetersen
Copy link
Contributor Author

jetersen commented Nov 5, 2019

Will do! 🎢

@jetersen
Copy link
Contributor Author

jetersen commented Nov 5, 2019

@jetersen
Copy link
Contributor Author

jetersen commented Nov 5, 2019

Travis failed due to shallow clone, so 👍

Adding this to your .travis.yml solves the problem

git:
  depth: false

@jetersen
Copy link
Contributor Author

jetersen commented Nov 5, 2019

Testing our Jenkins instance for good measure 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants