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

Errors with beta 2 #236

Closed
clairernovotny opened this issue Jan 21, 2019 · 32 comments · Fixed by #288
Closed

Errors with beta 2 #236

clairernovotny opened this issue Jan 21, 2019 · 32 comments · Fixed by #288

Comments

@clairernovotny
Copy link
Member

clairernovotny commented Jan 21, 2019

Tryign to use beta 2 gives me these errors

 StrictFilePathMarshaler must be used on a FilePath. [C:\dev\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool.csproj]                                                                                                              
    at LibGit2Sharp.Core.StrictFilePathMarshaler.MarshalManagedToNative(Object managedObj) [C:\dev\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool.csproj]                                                                        
    at System.StubHelpers.MngdRefCustomMarshaler.ConvertContentsToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome) [C:\dev\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool.csproj]                          
    at LibGit2Sharp.Core.NativeMethods.git_repository_discover(GitBuf buf, FilePath start_path, Boolean across_fs, FilePath ceiling_dirs) [C:\dev\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool.csproj]                         
    at LibGit2Sharp.Core.Proxy.<>c__DisplayClass219_0.<git_repository_discover>b__0(GitBuf buf) [C:\dev\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool.csproj]                                                                   
    at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever) [C:\dev\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool.csproj]                                                                                                  
    at LibGit2Sharp.Core.Proxy.git_repository_discover(FilePath start_path) [C:\dev\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool.csproj]                                                                                       
    at LibGit2Sharp.Repository.Discover(String startingPath) [C:\dev\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool.csproj]                                                                                                      
    at Microsoft.Build.Tasks.Git.GitOperations.LocateRepository(String directory) in /_/src/Microsoft.Build.Tasks.Git.Operations/GitOperations.cs:line 26 [C:\dev\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool.csproj]         
    at Microsoft.Build.Tasks.Git.RepositoryTasks.LocateRepository(LocateRepository task) in /_/src/Microsoft.Build.Tasks.Git.Operations/RepositoryTasks.cs:line 58 [C:\dev\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool\NuGetKeyVaultSignTool.csproj]

Using 1.0.0-beta-63127-02 works correctly, 1.0.0-beta2-18618-05 does not.

@clairernovotny clairernovotny changed the title Errors wtih beta 2 Errors with beta 2 Jan 21, 2019
@tmat
Copy link
Member

tmat commented Jan 22, 2019

@bording

@tmat
Copy link
Member

tmat commented Jan 22, 2019

Odd, this looks like basic functionality that's well covered by tests. We are also using 1.0.0-beta2-18618-05 in our repos and I haven't seen a failure like this.

@bording
Copy link

bording commented Jan 22, 2019

@onovotny Do you have a repro? Like @tmat said, that should be some pretty basic usage of LibGit2Sharp, so it's surprising to see that sort of error.

@clairernovotny
Copy link
Member Author

This repro'd for me both locally and on CI build for https://github.com/onovotny/NuGetKeyVaultSignTool

Just change the version in the props file: https://github.com/onovotny/NuGetKeyVaultSignTool/blob/master/Directory.Build.Props

CI build:
https://dev.azure.com/onovotny/GitBuilds/_build/results?buildId=1579

Look at the Pack step, at the bottom its log file, same problem.

@bording
Copy link

bording commented Jan 22, 2019

@onovotny I see that you're referencing both Microsoft.SourceLink.GitHub and Nerdbank.GitVersioning. Could you temporarily remove Nerdbank.GitVersioning and see if the problem still occurs?

Looking at the historical issues around that caused "StrictFilePathMarshaler must be used on a FilePath" errors, it's been related to having more than one copy of LibGit2Sharp in memory.

Those sorts of problems should have been mitigated, but I'm wondering if there is some new reason it would be causing a problem.

@tmat
Copy link
Member

tmat commented Jan 27, 2019

@onovotny Does removing Nerdbank.GitVersioning fix the issue?

@clairernovotny
Copy link
Member Author

Sorry, have not had a chance to take a look yet

@clairernovotny
Copy link
Member Author

It still repros for that even when I remove NB.GV.

@clairernovotny
Copy link
Member Author

Any ideas?

@bording
Copy link

bording commented Feb 9, 2019

@onovotny What do I need to be doing to repro it? It seems to be working fine when I build/pack from Visual Studio.

@clairernovotny
Copy link
Member Author

hmm...I just tried again and it's not repro'ing for me right now. very odd given that it repro'd locally and on Azure DevOps.

@clairernovotny
Copy link
Member Author

wait...I see something.

With the 2.2.101 SDK, I see the errors, even on Azure DevOps. When I try the 3.0.100-preview 2 SDK to build, I don't.

I'm guessing that we both have the 3.0.100 preview sdk as the default. Adding a global.json to pin the 2.2.100/101 sdk should cause it to repro locally.

@clairernovotny
Copy link
Member Author

Moreso, it works with the 3.0 SDK but not the 2.2 SDK:

Build with 2.2.101, you see this:
https://dev.azure.com/onovotny/GitBuilds/_build/results?buildId=1606&view=results

If you open the nupkg in NuGet Package Explorer and double-click the dll, you'll see the embedded ppdb data showing the sourcelink. It's wrong there, pointing at local files.

Built with the 3.0.100-preview2 sdk, here, doing the same thing, the sourcelink works correctly:
https://dev.azure.com/onovotny/GitBuilds/_build/results?buildId=1607&view=results

@bording
Copy link

bording commented Feb 9, 2019

I'm guessing that we both have the 3.0.100 preview sdk as the default.

I actually don't have a 3.0 SDK installed on this machine. I typically keep prerelease stuff on a VM instead.

The only SDKs I have installed are 2.1.503 and 2.2.102.

2.1.100/101 includes the 2.2.0 runtime, but 2.1.102 has the 2.2.1 runtime. I wonder if there was a bug fixed that could be relevant?

Can you try bumping up to 2.1.102 and see if that fixes things for you as well?

@clairernovotny
Copy link
Member Author

clairernovotny commented Feb 10, 2019

Weird... 2.2.102 fails here on Azure DevOps. It's just doing a dotnet build/pack. Look at the Pack step, at the logs, and at the bottom you'll see the errors.

https://dev.azure.com/onovotny/GitBuilds/_build/results?buildId=1608

@bording
Copy link

bording commented Feb 10, 2019

Okay, so if you build from Visual Studio, it's fine. If you build with dotnet build you get the warnings indicating that LibGit2Sharp isn't working correctly.

However, if you examine the binlog from invoking dotnet msbuild /bl you can see the warning are only coming from one of the projects, and not both.

I just installed the 3.0.100-preview-010184 SDK, and it does not produce the warnings, just like you said, @onovotny.

@tmat Is is possible that dotnet/coreclr#21606 is in 3.0 SDK preview 2? If so, then I think that might be the answer.

@clairernovotny
Copy link
Member Author

I have not tried building from VS

@bording
Copy link

bording commented Feb 10, 2019

At this point I suspect we're hitting the custom marshaler bug when running against .NET Core, and assuming it has already landed in the released 3.0 builds, it would explain why it's fine in VS (running against .NET Framework) and in 3.0.

@clairernovotny
Copy link
Member Author

Would that need to be backported to a 2.2 servicing release (or a 2.1 given that's LTS)? Not sure what scenario I have that's tripping this when building this with 2.2 when most people seem to be okay?

@bording
Copy link

bording commented Feb 10, 2019

Would that need to be backported to a 2.2 servicing release (or a 2.1 given that's LTS)?

Ideally yes, since if my assessment is correct, that fix is the only way to reliably use LibGit2Sharp from an MSBuild task on .NET Core.

Not sure what scenario I have that's tripping this when building this with 2.2 when most people seem to be okay?

I haven't upgraded to 1.0.0-beta2-18618-05 anywhere yet myself. Now I wonder if I'll hit it when I update.

@tmat
Copy link
Member

tmat commented Feb 10, 2019

@AaronRobinsonMSFT To comment on which versions of Core CLR dotnet/coreclr#21606 is fixed in and possible backporting.

@AaronRobinsonMSFT
Copy link
Member

Thanks @tmat.

The issue was fixed in 3.0 preview 2.

Not sure what scenario I have that's tripping this when building this with 2.2 ...

@onovotny We addressed this issue based on the following https://github.com/dotnet/coreclr/issues/19654 - it may help you to understand the issue in LibGit2Sharp.

Okay, so if you build from Visual Studio, it's fine.

From the looks of this it seems like the issue is related to using the CLI build to consume a library (via a Task/Target?) where the same code works just fine in Visual Studio, right? This makes sense because .NET Framework probably doesn't have the issue and Visual Studio uses .NET Framework for MSBuild.

With respect to backporting to 2.2, that is something I would like to avoid unless absolutely necessary (i..e there is no work around). For right now, this does work from Visual Studio, is the 2.2 CLI a hard requirement for the work at hand?

@jeffschwMSFT for his thoughts on potential backporting of dotnet/coreclr#21606. (cc @jkoritzinsky)

@NickCraver
Copy link
Member

FWIW, I'm hitting this as well with a build locally. Only noticed it today, but it's happening for others.

@Igorbek
Copy link

Igorbek commented Mar 12, 2019

I get the following errors with beta2, building locally with Vsts package:

...\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): error MSB4062: The "Microsoft.Build.Tasks.Git.LocateRepository" task could not be loaded from the assembly ...\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\..\tools\netcoreapp2.0\Microsoft.Build.Tasks.Git.dll. Assembly with same name is already loaded Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

@ctaggart
Copy link
Contributor

The StrictFilePathMarshaler warning shows up for me when I use Nerdbank.GitVersioning.

  Restore completed in 66.26 ms for C:\Users\taggac\github\froto\Serialization.Test\Froto.Serialization.Test.fsproj.
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning : StrictFilePathMarshaler must be used on a FilePath. [C:\Users\taggac\github\froto\Parser\Froto.Parser.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at LibGit2Sharp.Core.StrictFilePathMarshaler.MarshalManagedToNative(Object managedObj) [C:\Users\taggac\github\froto\Parser\Froto.Parser.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at System.StubHelpers.MngdRefCustomMarshaler.ConvertContentsToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome) [C:\Users\taggac\github\froto\Parser\Froto.Parser.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at LibGit2Sharp.Core.NativeMethods.git_repository_discover(GitBuf buf, FilePath start_path, Boolean across_fs, FilePath ceiling_dirs) [C:\Users\taggac\github\froto\Parser\Froto.Parser.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever) [C:\Users\taggac\github\froto\Parser\Froto.Parser.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at LibGit2Sharp.Repository.Discover(String startingPath) [C:\Users\taggac\github\froto\Parser\Froto.Parser.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at Microsoft.Build.Tasks.Git.GitOperations.LocateRepository(String directory) in /_/src/Microsoft.Build.Tasks.Git.Operations/GitOperations.cs:line 26 [C:\Users\taggac\github\froto\Parser\Froto.Parser.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at Microsoft.Build.Tasks.Git.RepositoryTasks.LocateRepository(LocateRepository task) in /_/src/Microsoft.Build.Tasks.Git.Operations/RepositoryTasks.cs:line 58 [C:\Users\taggac\github\froto\Parser\Froto.Parser.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning : StrictFilePathMarshaler must be used on a FilePath. [C:\Users\taggac\github\froto\Serialization\Froto.Serialization.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at LibGit2Sharp.Core.StrictFilePathMarshaler.MarshalManagedToNative(Object managedObj) [C:\Users\taggac\github\froto\Serialization\Froto.Serialization.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at System.StubHelpers.MngdRefCustomMarshaler.ConvertContentsToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome) [C:\Users\taggac\github\froto\Serialization\Froto.Serialization.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at LibGit2Sharp.Core.NativeMethods.git_repository_discover(GitBuf buf, FilePath start_path, Boolean across_fs, FilePath ceiling_dirs) [C:\Users\taggac\github\froto\Serialization\Froto.Serialization.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever) [C:\Users\taggac\github\froto\Serialization\Froto.Serialization.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at LibGit2Sharp.Repository.Discover(String startingPath) [C:\Users\taggac\github\froto\Serialization\Froto.Serialization.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at Microsoft.Build.Tasks.Git.GitOperations.LocateRepository(String directory) in /_/src/Microsoft.Build.Tasks.Git.Operations/GitOperations.cs:line 26 [C:\Users\taggac\github\froto\Serialization\Froto.Serialization.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.build.tasks.git\1.0.0-beta2-18618-05\build\Microsoft.Build.Tasks.Git.targets(20,5): warning :    at Microsoft.Build.Tasks.Git.RepositoryTasks.LocateRepository(LocateRepository task) in /_/src/Microsoft.Build.Tasks.Git.Operations/RepositoryTasks.cs:line 58 [C:\Users\taggac\github\froto\Serialization\Froto.Serialization.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.sourcelink.common\1.0.0-beta2-18618-05\build\Microsoft.SourceLink.Common.targets(53,5): warning : Source control information is not available - the generated source link is empty. [C:\Users\taggac\github\froto\Parser\Froto.Parser.fsproj]
C:\Users\taggac\.nuget\packages\microsoft.sourcelink.common\1.0.0-beta2-18618-05\build\Microsoft.SourceLink.Common.targets(53,5): warning : Source control information is not available - the generated source link is empty. [C:\Users\taggac\github\froto\Serialization\Froto.Serialization.fsproj]
C:\Users\taggac\github\froto\Serialization\obj\Debug\netstandard2.0\Froto.Serialization.Version.fs(14,69): warning FS2003: The attribute System.Reflection.AssemblyInformationalVersionAttribute specified version '0.6.2+8a37bb2', but this value is invalid and has been ignored [C:\Users\taggac\github\froto\Serialization\Froto.Serialization.fsproj]
C:\Users\taggac\github\froto\Parser\obj\Debug\netstandard2.0\Froto.Parser.Version.fs(14,69): warning FS2003: The attribute System.Reflection.AssemblyInformationalVersionAttribute specified version '0.6.2+8a37bb2', but this value is invalid and has been ignored [C:\Users\taggac\github\froto\Parser\Froto.Parser.fsproj]

Pull request to reproduce it is:
ctaggart/froto#100

ctaggart added a commit to ctaggart/froto that referenced this issue Mar 19, 2019
@ctaggart
Copy link
Contributor

I just confirmed what @onovotny mentioned, the previous beta, 1.0.0-beta-63127-02 does not produce these warnings.

@bording
Copy link

bording commented Mar 19, 2019

Unfortunately, if this is hitting the bug fixed by dotnet/coreclr#21606, and at this point it seems quite likely, then I don't think there's a workaround for it. We'd need that to be backported.

ctaggart added a commit to ctaggart/froto that referenced this issue Mar 19, 2019
* add Nerdbank.GitVersioning

* temp remove SourceLink

* try switching Froto.Parser.Test from netsoreapp2.0 to 2.1

* use Froto.sln

* latest dotnet 2.2.3

* try 2.2.2

* sdk is 2.2.105

* dist: xenial

* remove Froto.TypeProvider from Froto.sln

* back to netcoreapp2.0

* git fetch --unshallow

* Revert "fix Enum in message body error (#96)"

This reverts commit 40a86c7.

* add version.json

* disable nbgv for exe

* use previous SourceLink
dotnet/sourcelink#236

* PrivateAssets="All"

* upgrade to Nerdbank.GitVersioning" Version="2.3.136

* remove Break()
@aidapsibr
Copy link

Can I recommend adding a warning to users/updating the README to point to the functional package if they use the CLI? Just ran into this as well and 3.0 is a trek away still.

@AArnott
Copy link

AArnott commented May 29, 2019

I'm working on upgrading the https://github.com/tonerdo/coverlet.git repo to using sourcelink and the beta2 of this package exhibits the same problem, while beta1 works.

@AArnott
Copy link

AArnott commented May 29, 2019

I also got the same error as @Igorbek when switching from beta2 to beta1. I filed #286 to track.

@Igorbek
Copy link

Igorbek commented May 29, 2019

Thank you @AArnott. So it now seems to have been fixed by #277

@tmat
Copy link
Member

tmat commented Jun 22, 2019

Fixed by #288

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants