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

NullReferenceException via NuGet.Packaging.PhysicalPackageFile.GetStream #3160

Closed
stevenscreek opened this issue Jul 18, 2016 · 0 comments · Fixed by NuGet/NuGet.Client#768
Closed

Comments

@stevenscreek
Copy link

This repos in versions 3.5.0.1520 and 3.5.0.1611.
It does not repo in 3.4.4.1321

  • Create a new Windows class library project.
  • Use nuget spec on the Project.csproj to create a nuspec file. Provide concrete values for all substitution variables.
  • Add a nuget reference to Microsoft.AspNet.WebApi version 5.2.3
  • Add a minimal Web.config to the project. Ensure that the item type is <Content>
  • Build the project
  • Use nuget pack on Project.csproj to create the package.

The result is a null reference exception. I've attached a minimal solution that repos this.

    mscorlib.dll!System.IO.FileStream.Init(string path, System.IO.FileMode mode, System.IO.FileAccess access, int rights, bool useRights, System.IO.FileShare share, int bufferSize, System.IO.FileOptions options, Microsoft.Win32.Win32Native.SECURITY_ATTRIBUTES secAttrs, string msgPath, bool bFromProxy, bool useLongPath, bool checkHost)    Unknown
    mscorlib.dll!System.IO.FileStream.FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share)  Unknown
    mscorlib.dll!System.IO.File.OpenRead(string path)   Unknown
>   nuget.exe!NuGet.Packaging.PhysicalPackageFile.GetStream()   Unknown
    nuget.exe!NuGet.CommandLine.ProjectFactory.ReverseTransformFormFile.GetElement(NuGet.Packaging.IPackageFile file)   Unknown
    nuget.exe!NuGet.CommandLine.ProjectFactory.ReverseTransformFormFile.ReverseTransform(NuGet.Packaging.IPackageFile file, System.Collections.Generic.IEnumerable<NuGet.Packaging.IPackageFile> transforms)    Unknown
    nuget.exe!NuGet.CommandLine.ProjectFactory.ReverseTransformFormFile..ctor.AnonymousMethod__0()  Unknown
    mscorlib.dll!System.Lazy<System.Func<System.IO.Stream>>.CreateValue()   Unknown
    mscorlib.dll!System.Lazy<System.Func<System.IO.Stream>>.LazyInitValue() Unknown
    mscorlib.dll!System.Lazy<System.Func<System.IO.Stream>>.Value.get() Unknown
    nuget.exe!NuGet.CommandLine.ProjectFactory.ReverseTransformFormFile.GetStream() Unknown
    nuget.exe!NuGet.Packaging.PackageBuilder.WriteFiles(System.IO.Compression.ZipArchive package, System.Collections.Generic.HashSet<string> filesWithoutExtensions)    Unknown
    nuget.exe!NuGet.Packaging.PackageBuilder.Save(System.IO.Stream stream)  Unknown
    nuget.exe!NuGet.Commands.PackCommandRunner.BuildPackage(NuGet.Packaging.PackageBuilder builder, string outputPath)  Unknown
    nuget.exe!NuGet.Commands.PackCommandRunner.BuildFromProjectFile(string path)    Unknown
    nuget.exe!NuGet.Commands.PackCommandRunner.BuildPackage(string path)    Unknown
    nuget.exe!NuGet.Commands.PackCommandRunner.BuildPackage()   Unknown
    nuget.exe!NuGet.CommandLine.PackCommand.ExecuteCommand()    Unknown
    nuget.exe!NuGet.CommandLine.Command.ExecuteCommandAsync()   Unknown
    nuget.exe!NuGet.CommandLine.Command.Execute()   Unknown
    nuget.exe!NuGet.CommandLine.Program.MainCore(string workingDirectory, string[] args)    Unknown
    nuget.exe!NuGet.CommandLine.Program.Main(string[] args) Unknown

nuget-pack-exception.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment