Skip to content

Running from Native AOT app fails to build signature #2187

Description

@kzu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions