I wrote a custom smarttransport. After fetch, pull or clone I get valid data but the method throws LibGit2Sharp Exception with "error reading from the zlib stream".
Transport with upload-pack read->write->read->write works.
READ:
00fc5daa747d4ca7905ff8996f770ef74d1b894be3d2 HEAD multi_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed symref=HEAD:refs/heads/master agent=git/2.18.0.windows.1 003f5daa747d4ca7905ff8996f770ef74d1b894be3d2 refs/heads/master 003e5daa747d4ca7905ff8996f770ef74d1b894be3d2 refs/heads/test2 0000
WRITE:
0074want 5daa747d4ca7905ff8996f770ef74d1b894be3d2 multi_ack_detailed side-band-64k include-tag thin-pack ofs-delta 0032want 5daa747d4ca7905ff8996f770ef74d1b894be3d2 00000009done
READ:
0008NAK 0023Enumerating objects: 9, done. Counting objects: 100% (9/9), done. Compressing objects: 100% (6/6), done. 002bTotal 9 (delta 0), reused 0 (delta 0) 02e7PACK òx£ì-1-0 +=»+ÄälºNc !6Ìß$NAé+x-m763[AÁ+sª$C+!7eì[å$í¦Àn÷^A&ã:Cÿ+-T#&Ö+BfàªäëKê+Úg_·µ»}+²i¨yi·¦Ò+ï«gÅÉä+Ç \Ú¤þ}¹©]ks_.k8¬òx£ì-=-0@ß=º+ÄäþºÄäþpº ZéZszûÀ}z¦ëÏ\KpêÈUqòÉk+=-Ç U8O àú¨&oÁëÿ=ó
ª=d+AÊ4qóÏÇ:+ã-áß»>ãf´cÌÝe>zٳƾ2*/WÙó?«ô-hOÇ ªÄu}¬- -¿ýj~Ç@9[ÿ
DÊÎÁ¦¦ G¿¯Ûò[8 Ë-õ¿x£343 ¢Éd¸¦åîUFzÜ--£+²Ê½2.Þr³ê]Ùdh
x£ì-1-0@Ð=ºÄäLLöTBê¡þpmÀDñDj-²¦#¦³7}¯¦@°nël8eÔR-ª¿ëSûY'UM%IÓƒ+¹c_vx,g_3ý+¦p{--ûé4d©fbóPöÜÿÆø¬WRQ-ã»Ã¤J¦_Ðß¾ØKMº¥à 3Sã¦x£-¦-,+L¦QH+¤--,I,NIa.-à-3©îí+ §Ó-¿x£343 ¢Éd¸¦åîUFzÜ--£+²Ê½2.Þr³ê]Ùdh
fbóPöÜÿÆø¬WRQ-=âìBnï§+=ƒ º=¦|[c N+ô¦x£-¦-,+L¦QH+¤--,I,NIa.-ò +®*ªx£340031Q(JML+Mi+®(a+§u¦sQ?-§î¦O´¢¹¦,²Û+. H>x£-¦-,+L¦QH+¤--, )-öP¸ãyô
WRITE:
0000
Exception:
An unhandled exception of type 'LibGit2Sharp.LibGit2SharpException' occurred in LibGit2Sharp.dll
Additional information: error reading from the zlib stream
Callstack:
bei LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in C:\projects\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:Zeile 136. bei LibGit2Sharp.Core.Proxy.git_remote_fetch(RemoteHandle remote, IEnumerable
1 refSpecs, GitFetchOptions fetchOptions, String logMessage) in C:\projects\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:Zeile 2268. bei LibGit2Sharp.Commands.Fetch(Repository repository, String remote, IEnumerable
1 refspecs, FetchOptions options, String logMessage) in C:\projects\libgit2sharp\LibGit2Sharp\Commands\Fetch.cs:Zeile 76.
bei GitFunction.Test.Beta2.button1_Click(Object sender, EventArgs e) in C:\TFS\DS\ThomasZ\BeckhoffGitAdsService\GitAdsServicePackage\GitFunction.Test\Beta2.cs:Zeile 62. bei System.Windows.Forms.Control.OnClick(EventArgs e) bei System.Windows.Forms.Button.OnClick(EventArgs e) bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) bei System.Windows.Forms.Control.WndProc(Message& m) bei System.Windows.Forms.ButtonBase.WndProc(Message& m) bei System.Windows.Forms.Button.WndProc(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.Run(Form mainForm) bei GitFunction.Test.Program.Main() in C:\TFS\DS\ThomasZ\BeckhoffGitAdsService\GitAdsServicePackage\GitFunction.Test\Program.cs:Zeile 19. bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) bei System.Threading.ThreadHelper.ThreadStart()
Versions:
FYI: UTF8Encoding and Encoding.Utf8 are not equal. Encoding.Utf8 adds UTF8 BOM (Byte-order Mark). This leads to this error. Setting all encodings to UTF8Encoding in my code fixed my problem.