Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Html.ValidationSummary(ValidationSummary.All) throws NullReferenceException #4989

@rsheptolut

Description

@rsheptolut

This started after I've updated my project from RC1 to ASP.NET Core 1.0. The tag helper also throws this exception.
If instead you specify ValidationSummary.ModelOnly, there's no exception. But also no property-level errors, which is bad.
Workarond: traverse ViewData.ModelState.Values manually and generate appropriate html markup.

Stack trace:

System.NullReferenceException.
   в Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ValidationHelpers.Visit(ModelStateDictionary dictionary, ModelStateEntry modelStateEntry, ModelMetadata metadata, List1 orderedModelStateEntries)
   в Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ValidationHelpers.Visit(ModelStateDictionary dictionary, ModelStateEntry modelStateEntry, ModelMetadata metadata, List1 orderedModelStateEntries)
   в Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ValidationHelpers.GetModelStateList(ViewDataDictionary viewData, Boolean excludePropertyErrors)
   в Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultHtmlGenerator.GenerateValidationSummary(ViewContext viewContext, Boolean excludePropertyErrors, String message, String headerTag, Object htmlAttributes)
   в Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.GenerateValidationSummary(Boolean excludePropertyErrors, String message, Object htmlAttributes, String tag)
   в Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.ValidationSummary(Boolean excludePropertyErrors, String message, Object htmlAttributes, String tag)
   в Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperValidationExtensions.ValidationSummary(IHtmlHelper htmlHelper)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions