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

GitVersion 5.1.1 AppVeyor: Input string was not in a correct format. #1875

Closed
jetersen opened this issue Oct 30, 2019 · 4 comments · Fixed by #1878
Closed

GitVersion 5.1.1 AppVeyor: Input string was not in a correct format. #1875

jetersen opened this issue Oct 30, 2019 · 4 comments · Fixed by #1878
Labels
Milestone

Comments

@jetersen
Copy link
Contributor

jetersen commented Oct 30, 2019

Fails on this https://ci.appveyor.com/project/nmklotas/gitlabapiclient/builds/28479124#L77

https://github.com/nmklotas/GitLabApiClient/blob/082e81db571dd1ce894e79cacb2ff2734f6ef2c9/appveyor.yml

dotnet :   ERROR [10/30/19 6:38:07:03] An unexpected error occurred:
At line:1 char:1
+ dotnet gitversion /l console /output buildserver
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (  ERROR [10/30/...error occurred::String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
System.FormatException: Input string was not in a correct format.
   at System.Text.StringBuilder.FormatError()
   at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, Stri
ng format, ParamsArray args)
   at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
   at System.String.Format(String format, Object[] args)
   at GitVersion.Logging.Log.Write(Verbosity verbosity, LogLevel level, String format, Object[] args) in D:\a\1\s\src\GitVersionCore\Logging\Log.cs:line 45
   at GitVersion.Logging.LogExtensions.Write(ILog log, LogLevel level, String format, Object[] args) in D:\a\1\s\src\GitVersionCore\Logging\LogExtensions.cs:line 100
   at GitVersion.Logging.LogExtensions.Info(ILog log, String format, Object[] args) in D:\a\1\s\src\GitVersionCore\Logging\LogExtensions.cs:line 51
   at GitVersion.Helpers.GitRepositoryHelper.CreateFakeBranchPointingAtThePullRequestTip(ILog log, Repository repo, AuthenticationInfo authentication) in D:\a\1\s\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 208
   at GitVersion.Helpers.GitRepositoryHelper.NormalizeGitDirectory(ILog log, IEnvironment environment, String gitDirectory, AuthenticationInfo authentication, Boolean noFetch, String currentBranch, Boolean isDynamicRepository) 
in D:\a\1\s\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 111
   at GitVersion.GitPreparer.Prepare(Boolean normalizeGitDirectory, String currentBranch, Boolean shouldCleanUpRemotes) in D:\a\1\s\src\GitVersionCore\GitPreparer.cs:line 51
   at GitVersion.GitVersionCalculator.CalculateVersionVariables() in D:\a\1\s\src\GitVersionCore\GitVersionCalculator.cs:line 52
   at GitVersion.ExecCommand.Execute() in D:\a\1\s\src\GitVersionExe\ExecCommand.cs:line 40
   at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments) in D:\a\1\s\src\GitVersionExe\GitVersionExecutor.cs:line 117

Works fine on this build: https://ci.appveyor.com/project/nmklotas/gitlabapiclient/builds/28473392

@asbjornu
Copy link
Member

Seems like the problem occurs somewhere in here:

public void Write(Verbosity verbosity, LogLevel level, string format, params object[] args)
{
if (verbosity > Verbosity)
{
return;
}
var formattedString = FormatMessage(string.Format(format, args), level.ToString().ToUpperInvariant());
foreach (var appender in appenders)
{
appender.WriteTo(level, formattedString);
}
sb.Append(formattedString);
}

If we wrapped that in a try / catch and then added the invalid format string to the log output or exception message, it would be much easier to debug this issue. Could you do a fork of GitVersion and attempt that to see what may be going on here, @Casz?

@arturcic arturcic added the bug label Nov 1, 2019
@eric-winkler
Copy link
Contributor

I've successfully repro'd in a debugger, this is occuring when the CanonicalName of a remote tip contains {}, for example: refs/tags/0.0.154.0^{}.

I'll try and get a PR up to address

@arturcic
Copy link
Member

arturcic commented Nov 1, 2019

@Casz can you check that the fix works for you?

@arturcic arturcic added this to the 5.1.2 milestone Nov 1, 2019
@jetersen
Copy link
Contributor Author

jetersen commented Nov 5, 2019

I was blocked by #1876 so I'll check if this is now fixed :)

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.

4 participants