Skip to content

NuGet 3 does not handle errors in packages.config like 'incorrect allowedVersions', 'duplicate entries of a package' or just plain invalid xml and so on #481

@w5l

Description

@w5l

Using VS2015 (CTP6) and NuGet 3.0.60225.100, having a Packages.config with an allowed version filter crashes Nuget, which in turn kills Visual Studio.

This seems to happen when the allowedVersions="..." attribute contains a version number without at least one period (.).

  • Works: <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
  • Works: <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" allowedVersions="6.0.8" />
  • Works: <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" allowedVersions="6.0" />
  • Crash: <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" allowedVersions="6" />
  • Works: <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" allowedVersions="[6.0]" />
  • Crash: <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" allowedVersions="[6,7]" />
  • Works: <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" allowedVersions="[6.0,7.0]" />

From the event log:

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: NuGet.Packaging.PackagesConfigReaderException
Stack:
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

This issue is also described on Codeplex here: https://nuget.codeplex.com/workitem/4456

Metadata

Metadata

Assignees

Labels

Functionality:SDKThe NuGet client packages published to nuget.orgPriority:1High priority issues that must be resolved in the current sprint.Type:Bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions