Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

"dnu restore" should check whether an installed package is corrupted #1243

Closed
MattGal opened this issue Feb 19, 2015 · 1 comment
Closed
Assignees
Milestone

Comments

@MattGal
Copy link

MattGal commented Feb 19, 2015

If the users deletes the package cache folder in most cases, a simple KPM restore will fix this back up. This seems to be a fairly common scenario when using * versioning to ensure a new version is picked up.

I routinely delete this folder while VS is still running. When I do that, any DLL that was loaded at the time won't be delete-able due to the file handles open to it. That means I end up with package directories that ONLY contain something like this:

C:\Users\mattgal\.k\packages\Microsoft.Framework.Logging\1.0.0-beta4-10858\lib\aspnet50\Microsoft.Framework.Logging.dll  (because I was running something using this DLL at the time...)

Now, I've put my machine into a state that kpm command line tools don't know how to handle and which do not get a helpful error message:

System.IO.FileNotFoundException: Could not find file 'C:\Users\mattgal\.k\packages\Microsoft.Framework.Logging\1.0.0-beta4-10858\Microsoft.Framework.Logging.nuspec'.
File name: 'C:\Users\mattgal\.k\packages\Microsoft.Framework.Logging\1.0.0-beta4-10858\Microsoft.Framework.Logging.nuspec'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES se
cAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at NuGet.PhysicalFileSystem.OpenFile(String path)
   at NuGet.UnzippedPackage.EnsureManifest()
   at NuGet.UnzippedPackage..ctor(IFileSystem fileSystem, String manifestPath)
   at NuGet.PackageInfo.get_Package()
   at Microsoft.Framework.Runtime.NuGetDependencyResolver.FindCandidate(String name, SemanticVersionRange versionRange)
   at Microsoft.Framework.Runtime.NuGetDependencyResolver.GetDescription(LibraryRange libraryRange, FrameworkName targetFramework)
   at Microsoft.Framework.PackageManager.LocalWalkProvider.FindLibrary(LibraryRange libraryRange, FrameworkName targetFramework)
   at Microsoft.Framework.PackageManager.RestoreOperations.<>c__DisplayClass8_0.<FindLibraryByVersion>b__2(IWalkProvider provider)
   at Microsoft.Framework.PackageManager.RestoreOperations.<FindLibrary>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---

When such an invalid state is detected, either a corrective action should be suggested via error text, or (I'd be fine with this) just blow away that package folder if you can find a version-matching package.

@davidfowl
Copy link
Member

/cc @ChengTian I ran into this too.

@glennc glennc added the polish label Mar 5, 2015
@glennc glennc added this to the 1.0.0 milestone Mar 5, 2015
@muratg muratg modified the milestones: 1.0.0, 1.0.0-beta5 Mar 20, 2015
@muratg muratg modified the milestones: 1.0.0-beta6, 1.0.0-beta5 May 22, 2015
@muratg muratg modified the milestones: 1.0.0-beta7, 1.0.0-beta6 Jun 25, 2015
@ChengTian ChengTian modified the milestones: 1.0.0-beta6, 1.0.0-beta7 Jul 1, 2015
@ChengTian ChengTian changed the title KPM restore behavior needs to accommodate corrupted k package cache "dnu restore" should check whether an installed package is corrupted Jul 23, 2015
@ChengTian ChengTian added bug and removed polish labels Jul 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants