Errors when using SonaType Nexus repo as a NuGet source

We have an internal NuGet repo hosted on SonaType's Nexus product. There is no proxy involved and it works as a package source from Visual Studio 2017 without issue. When we try it as a package source from LinqPad v5 (even tried the Feb 2018 beta), it fails with the error "Unable to load the service index for source" as a NuGet.Protocol.Code.Types.FatalProtocolException.

I've tried it with and without user name/password because AD authentication is allowed. Although this repo does also allow anonymous access.

I can use the NuGet.Core package from a LinqPad query and pull packages with two lines of code:
var nexusRepo = PackageRepositoryFactory.Default.CreateRepository(@"https://www.myinternalserver.com/repository/nuget-group/");
nexusRepo.GetPackages().Take(1).Dump(); 
There are no logs being written out. Any advice on how I may be able to troubleshoot further?

Thanks

Comments

  • The error that you reported includes the following stack trace:

    Inner Exception: InvalidDataException

    The content at 'https://nexus.ingramcontent.com/repository/oms-nuget-group/index.json' is not a valid JSON object.

    at NuGet.Protocol.HttpStreamValidation.ValidateJObject(String uri, Stream stream)
    at NuGet.Protocol.HttpCacheUtility.d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at NuGet.Protocol.HttpSource.<>c__DisplayClass12_0`1.<<GetAsync>b__0>d.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at NuGet.Common.ConcurrencyUtilities.d__2`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at NuGet.Protocol.HttpSource.d__12`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at NuGet.Protocol.ServiceIndexResourceV3Provider.d__9.MoveNext()

    Does that help? Is the content at "https://nexus.ingramcontent.com/repository/oms-nuget-group/index.json" indeed a valid JSON object?
  • Thanks Joe. That does indeed help. I think the problem is on the Nexus end. The index.json returned is actually XML. Visual Studio must be working around this somehow or treating it as a v2 feed.

    Does LinqPad have a way to include a V2 nuget package source?

    The %AppData%\Local\LINQPad\LINQPad.nuget.config has a protocolVersion property for the package source, but it doesn't seem like this config is being used. I believe it is using the NuGetSources.xml in %AppData%\Roaming\LINQPad instead and I don't see a version property there.

    I'll try to work with Nexus, but I'm not hopeful that I'll gain much ground there. We were trying to move to a consolidated package server with Nexus, but it needs to treat NuGet packages as first class citizens.

    Thanks again

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!