libgit2 / libgit2/libgit2sharp

Running from Native AOT app fails to build signature

Open
#2,187 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

This is a clean repro:

#:package LibGit2Sharp@0.*
#:package Spectre.Console@0.*
using System;
using LibGit2Sharp;
using Spectre.Console;

using var repo = new Repository(Environment.CurrentDirectory);
var signature = repo.Config.BuildSignature(DateTimeOffset.Now);

if (signature == null)
{
    AnsiConsole.MarkupLine("[red] Unexpected error: Git user.name and/or user.email are not configured.[/]");
    return 1;
}
else
{
    AnsiConsole.MarkupLine($"[lime]{signature}[/]");
    return 0;
}

When running this script from a git repo dir with dotnet run --file repro.cs, you get the proper signature built from the found config.

Doing dotnet publish repro.cs and then running it from artifacts\repro\repro.exe will result in the error path consistently.

The PR #2188 fixes it and can be verified by changing the above repro script to use my CI feed:

#:package LibGit2Sharp@0.31.1
#:package Spectre.Console@0.*
#:property RestoreSources=https://api.nuget.org/v3/index.json;https://pkg.kzu.app/index.json

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided repro.cs script and compare dotnet run --file repro.cs with dotnet publish repro.cs followed by running artifacts\repro\repro.exe. Review PR #2188 and verify that the published Native AOT app builds the expected Git signature from configuration instead of taking the error path.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.