Closed JimmyPandas closed 4 years ago
@JimmyLzy that stack trace doesn't seem to mention Octokit, and it looks like it's related to NLog trying to format a GUID found in some payload. We don't use NLog inside Octokit, so I'm not sure how to reproduce this or what the root cause is.
@shiftkey Yeah it was due to our logger which hides real exception. The exception was actually not found. Does release api need to pass credentials? Octokit.NotFoundException: Not Found at Octokit.Connection.HandleErrors(IResponse response) in /Users/shiftkey/src/octokit.net/Octokit/Http/Connection.cs:line 663 at Octokit.Connection.RunRequest(IRequest request, CancellationToken cancellationToken) in /Users/shiftkey/src/octokit.net/Octokit/Http/Connection.cs:line 642 at Octokit.Connection.Run[T](IRequest request, CancellationToken cancellationToken) in /Users/shiftkey/src/octokit.net/Octokit/Http/Connection.cs:line 626 at Octokit.ApiConnection.Post[T](Uri uri, Object data, String accepts, String contentType) in /Users/shiftkey/src/octokit.net/Octokit/Http/ApiConnection.cs:line 273
@JimmyLzy yes, releases need the client.Credentials
to be set as the documentation indicates:
Users with push access to the repository can create a release.
@shiftkey Yeah it is working now. Thx a lot for helping me!
When using this library to create a release, I got System.FormatException. I have also attached the code and stack trace. Could you please help me to find out how to solve the issue?
var releaseData = new NewRelease(tagToRelease) { TargetCommitish = mainBranch, Name = tagToRelease, Body = commitMessage, }; await client.Repository.Release.Create(owner, repoName, releaseData);
Stack trace: System.FormatException: Format string can be only "D", "d", "N", "n", "P", "p", "B", "b", "X" or "x". at System.Guid.ToString(String format, IFormatProvider provider) at NLog.MessageTemplates.ValueFormatter.SerializeSimpleObject(Object value, String format, IFormatProvider formatProvider, StringBuilder builder, Boolean convertToString) at NLog.MessageTemplates.ValueFormatter.SerializeDictionaryObject(IDictionary dictionary, String format, IFormatProvider formatProvider, StringBuilder builder, SingleItemOptimizedHashSet
1 objectsInPath, Int32 depth) at NLog.MessageTemplates.ValueFormatter.SerializeWithoutCyclicLoop(IEnumerable collection, String format, IFormatProvider formatProvider, StringBuilder builder, SingleItemOptimizedHashSet
1 objectsInPath, Int32 depth) at NLog.MessageTemplates.ValueFormatter.FormatObject(Object value, String format, IFormatProvider formatProvider, StringBuilder builder) at NLog.MessageTemplates.ValueFormatter.FormatValue(Object value, String format, CaptureType captureType, IFormatProvider formatProvider, StringBuilder builder) at NLog.MessageTemplates.TemplateRenderer.Render(String template, IFormatProvider formatProvider, Object[] parameters, Boolean forceTemplateRenderer, StringBuilder sb, IList`1& messageTemplateParameters)