nuget_a87d04b62ebf PackageManager.InstallPackage is undebuggable

May 26, 2011 at 2:50 PM

1, VS2010 Open NuGet.sln

2, Set Solution -> Common Properties -> Startup Project -> Single startup project

   CommandLine

3, Set CommandLine -> Properties -> Debug -> Command line arguments:

   install elmah /Version 1.2.0.1 /Source http://go.microsoft.com/fwlink/?LinkID=206669 /OutputDirectory Packages

4, Build (F6)

5, Set break point into CommandLine/Propgrams.cs LINE 77:

   var currentColor = ConsoleColor.Gray;

5, Start Debugging (F5)

6, See (Exception e)

System.TypeLoadException was caught

  Message=Inheritance security rules violated while overriding member: 'NuGet.ManifestMetadata.Validate(System.ComponentModel.DataAnnotations.ValidationContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

  Source=NuGet.Core

  TypeName=NuGet.ManifestMetadata.Validate(System.ComponentModel.DataAnnotations.ValidationContext)

  StackTrace:

       at NuGet.ZipPackage.EnsureManifest()

       at NuGet.ZipPackage..ctor(Func`1 streamFactory, Boolean enableCaching) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\Packages\ZipPackage.cs:line 60

       at NuGet.ZipPackageFactory.CreatePackage(Func`1 streamFactory) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\Utility\ZipPackageFactory.cs:line 7

       at NuGet.PackageDownloader.DownloadPackage(Uri uri, Byte[] packageHash, IPackageMetadata package) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\Utility\PackageDownloader.cs:line 72

       at NuGet.DataServicePackage.DownloadAndVerifyPackage(IPackageRepository repository) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\Packages\DataServicePackage.cs:line 266

       at NuGet.DataServicePackage.DownloadAndVerifyPackage() in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\Packages\DataServicePackage.cs:line 247

       at NuGet.DataServicePackage.LazyWithRecreate`1.get_Value() in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\Packages\DataServicePackage.cs:line 338

       at NuGet.DataServicePackage.get_FrameworkAssemblies() in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\Packages\DataServicePackage.cs:line 203

       at NuGet.PackageExtensions.HasProjectContent(IPackage package) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\Extensions\PackageExtensions.cs:line 46

       at NuGet.PackageWalker.GetPackageTarget(IPackage package) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\PackageWalker\PackageWalker.cs:line 173

       at NuGet.PackageWalker.GetPackageInfo(IPackage package) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\PackageWalker\PackageWalker.cs:line 166

       at NuGet.PackageWalker.Walk(IPackage package) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\PackageWalker\PackageWalker.cs:line 76

       at NuGet.InstallWalker.ResolveOperations(IPackage package) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\PackageWalker\InstallWalker.cs:line 283

       at NuGet.PackageManager.Execute(IPackage package, IPackageOperationResolver resolver) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\PackageManager.cs:line 131

       at NuGet.PackageManager.InstallPackage(IPackage package, Boolean ignoreDependencies) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\PackageManager.cs:line 124

       at NuGet.PackageManager.InstallPackage(String packageId, Version version, Boolean ignoreDependencies) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\PackageManager.cs:line 120

       at NuGet.PackageManager.InstallPackage(String packageId, Version version) in c:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\Core\PackageManager.cs:line 114

       at NuGet.Commands.InstallCommand.ExecuteCommand() in C:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\CommandLine\Commands\InstallCommand.cs:line 75

       at NuGet.Commands.Command.Execute() in C:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\CommandLine\Commands\Command.cs:line 48

       at NuGet.Program.Main(String[] args) in C:\RandaTFS\3rdParty\NuGet\nuget_a87d04b62ebf\src\CommandLine\Program.cs:line 73

  InnerException: 

May 26, 2011 at 6:09 PM

http://nuget.codeplex.com/discussions/246086 discusses it. Workaround is to comment out the SecurityTransparent attribute in the AssemblyInfo.cs of NuGet.Core.

May 27, 2011 at 8:07 AM

Dear DavidEbbo,

 I put CODE_COVERAGE  into DefineConstants properties of PropertyGroups of Release, Debug and Coverage of "nuget_0eb26dbc1d79\Build\NuGet.Settings.targets" and I tried the test case above but the result stayed same.

The "nuget_0eb26dbc1d79\src\Core\Properties\AssemblyInfo.cs"

...

#if !CODE_COVERAGE

[assembly: SecurityTransparent]

#endif

Attila.

 

May 27, 2011 at 8:42 AM

Dear DavidEbbo,

If I commented out SecurityTransparent in "nuget_0eb26dbc1d79\src\Core\Properties\AssemblyInfo.cs" that is working.

// [assembly: SecurityTransparent]

Thanks, Attila.

Developer
May 27, 2011 at 8:42 AM

Just comment out the attribute while debugging.