Object reference not set to an instance of an object.

description

When I try to upload a new package on my local Nuget Gallery Server, the first step, actual upload file, goes fine. But next, when you submit a form populated with package info it fails with the below:

Server Error in '/' Application.

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

file attachments

comments

I’ve had a look in the Gallery.Server\App_Data folder and can see the folder “packages” populate with the package I’m trying to upload before it craps out but when I look at “App_Data\Logs the GalleryServer.log is empty.
Think I’ve hit a wall with this so if anyone has any ideas or suggestions it would be greatly appreciated
Thanks

From what I can see the package gets created on the Nuget Gallery Server BEFORE you can select what type of package it is (i.e. a Module). Then when it posts from the next page where you fill out additional information, it simply keeps trying to use the
PackageType it gets from the Nuget Package Server, not the one you select.. so it always stays NULL. Can't see how to resolve this though -_-

In my case the weird behaviour was caused by WebDAV module intercepting REST verb PUT.
In the first step, when you first upload the module file, the UI will use POST request to the gallery server to create the package. This step works fine and the record is created in the database without the "PackageType" field being populated. @hai2u:
This is correct behaviour, the PackagesType should be populated in the next step.
In the next step you can update the module details (including "Package Type"). When you submit the form the UI will use PUT request ()following REST protocol) to the gallery server to update the package detail. In this step the WebDAV module seems
to intercept the request, so the data doesn't get updated.
The fix is to disable the the WebDAV module in the gallery server Web.config. In my cases the config looks something like this: