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

[BUG] NugetTask fail when project has dependencies hosted on private repos #77

Closed
cegio opened this issue Nov 5, 2019 · 15 comments
Closed
Labels
bug Something isn't working

Comments

@cegio
Copy link

cegio commented Nov 5, 2019

Describe the bug

When your csproj reference package that are not hosted on nuget.org, it makes the build fail on PharmacistNuGetTask

Steps To Reproduce

Provide the steps to reproduce the behavior:
In your csproj add a PackageReference to a nuget package that is hosted on a private repo

Expected behavior

No build errors, and Pharmacist.Nuget.g.cs generated for all nuget packages (or at least the ones that could be downloaded)

Environment

  • OS: macOS/Windows
  • Device:
  • Version: 1.2.2
  • Working Version:

Additional context
Copy of stacktrace :
/.nuget/packages/pharmacist.msbuild/1.2.2/buildTransitive/netstandard2.0/Pharmacist.MSBuild.targets(5,5): Error: PharmacistNuGetTask: System.NullReferenceException: Object reference not set to an instance of an object
at NuGet.Protocol.DownloadResourceV3.GetDownloadUrl (NuGet.Packaging.Core.PackageIdentity identity, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x0007a] in :0
at NuGet.Protocol.DownloadResourceV3.GetDownloadResourceResultAsync (NuGet.Packaging.Core.PackageIdentity identity, NuGet.Protocol.Core.Types.PackageDownloadContext downloadContext, System.String globalPackagesFolder, NuGet.Common.ILogger logger, System.Threading.CancellationToken token) [0x000bd] in :0
at Pharmacist.Core.NuGet.NuGetPackageHelper+<>c__DisplayClass16_0.b__4 (System.ValueTuple2[T1,T2] item) [0x00094] in <c092543ffe3f4af794d331f791699d8f>:0 at Pharmacist.Core.NuGet.NuGetPackageHelper.GetPackagesToCopy (System.Collections.Generic.IReadOnlyCollection1[T] startingPackages, NuGet.Protocol.Core.Types.DownloadResource downloadResource, System.Collections.Generic.IReadOnlyCollection1[T] frameworks, System.Boolean getDependencies, System.Threading.CancellationToken token) [0x001f2] in <c092543ffe3f4af794d331f791699d8f>:0 at Pharmacist.Core.NuGet.NuGetPackageHelper.DownloadPackageFilesAndFolder (System.Collections.Generic.IReadOnlyCollection1[T] packageIdentities, System.Collections.Generic.IReadOnlyCollection1[T] frameworks, NuGet.Protocol.Core.Types.DownloadResource downloadResource, System.Boolean getDependencies, System.Collections.Generic.IReadOnlyCollection1[T] packageFolders, System.String packageOutputDirectory, System.Threading.CancellationToken token) [0x00084] in :0
at Pharmacist.Core.NuGet.NuGetPackageHelper.DownloadPackageFilesAndFolder (System.Collections.Generic.IReadOnlyCollection1[T] libraryIdentities, System.Collections.Generic.IReadOnlyCollection1[T] frameworks, NuGet.Configuration.PackageSource nugetSource, System.Boolean getDependencies, System.Collections.Generic.IReadOnlyCollection1[T] packageFolders, System.String packageOutputDirectory, System.Threading.CancellationToken token) [0x00288] in <c092543ffe3f4af794d331f791699d8f>:0 at Pharmacist.Core.Extractors.NuGetExtractor.Extract (System.Collections.Generic.IReadOnlyCollection1[T] targetFrameworks, System.Collections.Generic.IReadOnlyCollection1[T] packages, System.String packageOutputDirectory) [0x0008a] in <c092543ffe3f4af794d331f791699d8f>:0 at Pharmacist.Core.ObservablesForEventGenerator.ExtractEventsFromNuGetPackages (System.IO.TextWriter writer, System.Collections.Generic.IReadOnlyCollection1[T] packages, System.Collections.Generic.IReadOnlyCollection`1[T] frameworks, System.String packageOutputFolder) [0x00090] in :0
at Pharmacist.MsBuild.PharmacistNuGetTask.Execute () [0x0014b] in :0 (Tech5.Core)

@cegio cegio added the bug Something isn't working label Nov 5, 2019
@open-collective-bot
Copy link

open-collective-bot bot commented Nov 5, 2019

Hey @cegio 👋,

Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider contributing financially.

https://opencollective.com/reactiveui

PS.: We offer priority support for all financial contributors. Don't forget to add priority label once you start contributing 😄

An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms!

@michaelstonis
Copy link

I am seeing the same issue when we have pointers to our nuget packages hosted on Azure DevOps.

@glennawatson is there a place in code that would be a good starting point to take a look at for this? I might have some availability to take a peek into here.

@AlexanderMelchers
Copy link

What's the status on this? I'm currently in an upgrade project on our solution, and as part decided to start using ReactiveUI. However, we have a bunch of legacy NuGet-packages, and as soon as I install Pharmacist, I get this NullReferenceException. Initially, Visual Studio would even freeze every time I opened it. I had no idea what was going on, but now turning here it seems that our packages on Azure DevOps might be the problem.

Is there any way around this (config option to turn off scanning proprietary packages?), or am I just forced to fall back on the ReactiveUI.Events.*?

@glennawatson
Copy link
Contributor

We are moving to source generators for next revision which doesn't suffer from nuget source issues. Just have to wait for the visual studio version that supports it next week n

@AlexanderMelchers
Copy link

Cool! Looking forward to it. Not that the ReactiveUI.Events.*-packages are a bad option for the time being. But the less dependencies our project has, the better! Thanks!

@AlexanderMelchers
Copy link

Again asking what the status of this issue is, since it looks like I'm again running into it.

Since my last post here I simply continued using ReactiveUI.Events.*, but have now upgraded Xamarin Forms to version 5.0. With this upgrade, the Expander-control, previously a part of XF, has now been moved into the Xamarin Community Toolkit (see here). Consequently, issues have arisen in using the ReactiveUI.Events.XamForms-package that still contains references to the control that now no longer exists.

I thought I could work around this issue by generating events for Xamarin Forms and Xamarin Essentials myself, in a separate project within my solution. This "events"-project is then referenced by those projects previously using packages from the ReactiveUI.Events.*-namespace. However, when building my solution, I'm now getting the exact same error as above again. It looks like Pharmacist doesn't just run on the project I set up separately to generate my events for me, but simply runs over all my projects, looking for events...

@AlexanderMelchers
Copy link

We are moving to source generators for next revision which doesn't suffer from nuget source issues. Just have to wait for the visual studio version that supports it next week

Would this also give us control over which packages Pharmacist tries to process? Because I think that would be the ideal solution, to somehow be able to indicate a list of packages Pharmacist processes or explicitly excludes from processing. Because even if Pharmacist might be able to access all NuGet-packages used by a solution, it might be undesirable to have it generate event bindings for all.

@glennawatson
Copy link
Contributor

glennawatson commented Feb 2, 2021

It will only generate events for the explicit classes you call Events() on. It has no awareness of NuGet packages.

The code is all ready to go just need time to do a push of a NuGet push.

Monitor over here https://github.com/reactivemarbles/ObservableEventsSourceGenerator

GitHub
Contribute to reactivemarbles/ObservableEventsSourceGenerator development by creating an account on GitHub.

@softlion
Copy link

2 years later, still no fix.

@glennawatson
Copy link
Contributor

And sarcastic comments absolutely makes things happen faster.

@anaisbetts
Copy link
Member

@glennawatson thanks for all of your hard work on Pharmacist, it's a great concept and I think the new Source Generator version will be even better! 💖

@glennawatson
Copy link
Contributor

glennawatson commented May 29, 2021

See https://www.nuget.org/packages/ReactiveMarbles.ObservableEvents.SourceGenerator/ and https://github.com/reactivemarbles/ObservableEventsSourceGenerator

This uses the dotnet nuget system rather than a custom nuget manager, so can handle private nugets.

Allows to get an observables for property changed events.
GitHub
Contribute to reactivemarbles/ObservableEventsSourceGenerator development by creating an account on GitHub.

@softlion
Copy link

Does you answer hides that you are shut downing pharmacist and redirect to those projects instead ?

Or is it only that you don’t care about the users of pharmacists and the management of this projet so you don’t even want to see any pr from anyone in this field ?

@glennawatson
Copy link
Contributor

@softlion two years without any PR doesn't qualify you to make such a statement.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants