3
Vote

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.

Source Error:


Line 34: var iconLinkText = string.Empty;
Line 35: }
Line 36: <ul class="@Model.PackageType.ToLower()"> Line 37: @if (!string.IsNullOrWhiteSpace(Model.IconUrl)) {
Line 38: <li class="logo"><img src="@Model.IconUrl" alt="Package Icon" /><span class="violator">Logo</span></li>


Source File: c:\NugetG\Website\src\Orchard.Web\Themes\OrchardGallery\Views\Orchard.Gallery\UploadPackageLogoAndScreenshots\Index.cshtml Line: 36

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
ASP._Page_Themes_OrchardGallery_Views_Orchard_Gallery_UploadPackageLogoAndScreenshots_Index_cshtml.Execute() in c:\NugetG\Website\src\Orchard.Web\Themes\OrchardGallery\Views\Orchard.Gallery\UploadPackageLogoAndScreenshots\Index.cshtml:36
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +279
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +103
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +172
Orchard.Mvc.ViewEngines.ThemeAwareness.<>c__DisplayClass7.<FindView>b__5(ViewContext viewContext, TextWriter writer, IViewDataContainer viewDataContainer) in c:\NugetG\Website\src\Orchard\Mvc\ViewEngines\ThemeAwareness\LayoutAwareViewEngine.cs:54
Orchard.Mvc.ViewEngines.ThemeAwareness.LayoutView.Render(ViewContext viewContext, TextWriter writer) in c:\NugetG\Website\src\Orchard\Mvc\ViewEngines\ThemeAwareness\LayoutAwareViewEngine.cs:84
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +383
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +32
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +784900
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation) +784900
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +784900
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation) +784900
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +784900
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation) +784900
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +784900
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation) +784900
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +784900
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation) +784900
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +784976
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54
Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in c:\NugetG\Website\src\Orchard\Mvc\Routes\ShellRoute.cs:148
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

file attachments

comments

mgarrigan wrote Jun 8, 2011 at 12:43 PM

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

mgarrigan wrote Jun 8, 2011 at 12:44 PM

.

mtech wrote Jun 20, 2011 at 6:45 PM

Anyone have any suggestions?

hai2u wrote Jan 18, 2012 at 7:25 PM

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 -_-

Gnosis74 wrote Oct 22 at 11:44 AM

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:
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
.
.
.
     <remove name="WebDAVModule" />
    </modules>
    <handlers>
       <remove name="WebDAV" />
.
.
.
    </handlers>