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

Local Relative Path Source Shows Packages, Fails to Install #376

Closed
ncosentino opened this issue Mar 5, 2021 · 3 comments
Closed

Local Relative Path Source Shows Packages, Fails to Install #376

ncosentino opened this issue Mar 5, 2021 · 3 comments

Comments

@ncosentino
Copy link

Description

I have my nuget config such that I have a local repository defined as:
<add key="LocalNexus" value="..\..\..\..\nuget-repo" />

This allows me to properly see nuget packages on my machine, which is awesome :) The problem is that every install attempt gets me a null reference exception:

Unable to install package Package 1.0.7733.29898
System.NullReferenceException: Object reference not set to an instance of an object
  at NugetForUnity.NugetHelper.Install (NugetForUnity.NugetPackage package, System.Boolean refreshAssets) [0x00236] in <ebb7710be32040ba9a0cb144ce2a8967>:0 
UnityEngine.Debug:LogErrorFormat (string,object[])
NugetForUnity.NugetHelper:Install (NugetForUnity.NugetPackage,bool)
NugetForUnity.NugetHelper:InstallIdentifier (NugetForUnity.NugetPackageIdentifier,bool)
NugetForUnity.NugetWindow:DrawPackage (NugetForUnity.NugetPackage,UnityEngine.GUIStyle,UnityEngine.GUIStyle)
NugetForUnity.NugetWindow:DrawPackages (System.Collections.Generic.List`1<NugetForUnity.NugetPackage>)
NugetForUnity.NugetWindow:DrawOnline ()
NugetForUnity.NugetWindow:OnGUI ()
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
  • NuGet Package: Local nuget package in my local "server" (i.e. just a folder path)
  • NuGetForUnity Version: 3.0.1
  • Unity Version: 2020.2.6f1
  • Operating System: Windows10
@ncosentino
Copy link
Author

This trace is probably more useful because it shows trying to go to nuget.org to find it, which is wrong:

Unable to retrieve package from http://www.nuget.org/api/v2/Packages(Id='Package',Version='1.0.7733.29898')
System.Net.WebException: The remote server returned an error: (404) Not Found.
  at System.Net.HttpWebRequest+<GetResponseFromData>d__240.MoveNext () [0x00152] in <aa976c2104104b7ca9e1785715722c9d>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Net.HttpWebRequest.GetResponse () [0x00013] in <aa976c2104104b7ca9e1785715722c9d>:0 
  at NugetForUnity.NugetHelper.RequestUrl (System.String url, System.String userName, System.String password, System.Nullable`1[T] timeOut) [0x000b9] in <ebb7710be32040ba9a0cb144ce2a8967>:0 
  at NugetForUnity.NugetPackageSource.GetPackagesFromUrl (System.String url, System.String username, System.String password) [0x0006c] in <ebb7710be32040ba9a0cb144ce2a8967>:0 
  at NugetForUnity.NugetPackageSource.GetSpecificPackage (NugetForUnity.NugetPackageIdentifier package) [0x0007b] in <ebb7710be32040ba9a0cb144ce2a8967>:0 
UnityEngine.Debug:LogErrorFormat (string,object[])
NugetForUnity.NugetPackageSource:GetSpecificPackage (NugetForUnity.NugetPackageIdentifier)
NugetForUnity.NugetHelper:GetOnlinePackage (NugetForUnity.NugetPackageIdentifier)
NugetForUnity.NugetHelper:GetSpecificPackage (NugetForUnity.NugetPackageIdentifier)
NugetForUnity.NugetHelper:InstallIdentifier (NugetForUnity.NugetPackageIdentifier,bool)
NugetForUnity.NugetWindow:DrawPackage (NugetForUnity.NugetPackage,UnityEngine.GUIStyle,UnityEngine.GUIStyle)
NugetForUnity.NugetWindow:DrawPackages (System.Collections.Generic.List`1<NugetForUnity.NugetPackage>)
NugetForUnity.NugetWindow:DrawOnline ()
NugetForUnity.NugetWindow:OnGUI ()
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

@toshiya14
Copy link

I am facing the same problem.

@tonygiang
Copy link
Contributor

As you all probably can see, I have submitted a fix for this issue. You will still see a 404 error with this fix. That's all intended. NuGetForUnity will try to find packages from sources in the order you sort them under Edit > Preferences > NuGet For Unity. By default, http://www.nuget.org/api/v2/ will be the top source of the list and that's where this tool will find your package from first. The 404 error will appear if the package you're installing is local-only, and it will still be installed when NuGet goes down the list of sources and find your local folder.

jwittner added a commit that referenced this issue Jan 3, 2022
Fix issue #376: Local Relative Path Source Shows Packages, Fails to Install
@jwittner jwittner closed this as completed Jan 3, 2022
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

No branches or pull requests

4 participants