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

Clone test - The type initializer for 'ManagedHttpSmartSubtransportStream' threw an exception #151

Open
savornicesei opened this issue Aug 19, 2021 · 10 comments

Comments

@savornicesei
Copy link

Hi,

I'm just running the build script on develop branch, on W10 `.\build.ps1' and I get this error on the Clone test:

========================================
Git-Clone
========================================
Cloning repo https://github.com/WCOMAB/CakeGitTestRepo.git...
An error occurred when executing task 'Git-Clone'.

----------------------------------------
Teardown
----------------------------------------
Finished running tasks.
Trying to clean up test repo D:/OSS/cake-build/upstream-Cake_Git/TestRepo
Successfully cleaned test repo D:/OSS/cake-build/upstream-Cake_Git/TestRepo
Error: One or more errors occurred.
        The type initializer for 'ManagedHttpSmartSubtransportStream' threw an exception.

Inner Exception:
    Operation is not supported on this platform.
An error occurred when executing task 'Test'.

Is there some setup required for succesfully run the net461 tests?

Thanks,
Simo

@augustoproiete
Copy link
Member

I can repro on a Windows 10 VM with .NET Framework 4.8 installed:

image

@savornicesei
Copy link
Author

Thanks for confirmation.
I tried with the latest libgit2sharp but got the same error. One thing that I noticed is that libgit2sharp targets only netstandard2.0;netcoreapp2.1 but netstandard2.0 should be compatible with .net461.

@augustoproiete
Copy link
Member

@savornicesei Indeed the problem is internal to libgit2sharp and will need to be fixed there. Tracking via libgit2/libgit2sharp#1904

@SergeiTerentev
Copy link

Hi, I have faced with same error, what has broken? windows update?

@augustoproiete
Copy link
Member

@SergeiTerentev Could be... The libgit2sharp team might know more details -> libgit2/libgit2sharp#1904

@SergeiTerentev
Copy link

Here is workaround:
#addin nuget:?package=Cake.Git&version=1.0.1
It use previous version of libgit2sharp and has no issue

@devlead
Copy link
Member

devlead commented Aug 26, 2021

Here is workaround:
#addin nuget:?package=Cake.Git&version=1.0.1
It use previous version of libgit2sharp and has no issue

Interesting previous versions don't work with newer Linux distributions and MacOS versions.

Guess the workaround could then be to pin the version with an environment variable until it's fixed upstream i.e.

#addin nuget:?package=Cake.Git&%CAKE_GIT_VERSION_OVERRIDE%

var testCloneRepo           = MakeAbsolute(Directory("./TestRepo/CloneRepo"));
var sourceUrl = "https://github.com/WCOMAB/CakeGitTestRepo.git";


if (DirectoryExists(testCloneRepo))
{
    DeleteDirectory(
        testCloneRepo,
        new DeleteDirectorySettings {
            Recursive = true,
            Force = true
        }
    );
}

Information("Cloning repo {0}...", sourceUrl);
var repo = GitClone(sourceUrl, testCloneRepo);
Information("Cloned {0}.", repo);

And then it can be overridden by an env variable like this

$ENV:CAKE_GIT_VERSION_OVERRIDE="version=1.01"
dotnet cake .\cakegit.cake

@devlead
Copy link
Member

devlead commented Aug 26, 2021

But if previous versions work it's even more clear it's an upstream issue.

@Imperatorn
Copy link

Here is workaround:
#addin nuget:?package=Cake.Git&version=1.0.1
It use previous version of libgit2sharp and has no issue

This worked for me. You just saved my life

@pascalberger
Copy link
Member

pascalberger commented Dec 3, 2023

libgit2/libgit2sharp#1904 has been closed as fixed in LibGit2Sharp 0.29.0

Created #176 to track update of Cake.Git to LibGit2Sharp 0.29.0

pmiossec added a commit to git-tfs/git-tfs that referenced this issue Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants