Error on forms, frontend and backoffice: The type initializer for 'Nested' threw an exception
I don't know why as it wasn't the case earlier today.
I have some forms in an Umbraco 7.5.3 solution, among others a contact form.
In backoffice, when I click on let's say the contact form, I get an error:
"Unable to load form: The type initializer for 'Nested' threw an exception."
In frontend the forms throw this:
"Destination array is not long enough to copy all the items in the collection. Check array index and length".
Earlier today I was able to read entries in backoffice of the contact form.
But when I try now, the screen is empty.
From the Umbraco log:
2016-12-27 14:50:25,756 [P26716/D14/T127] WARN umbraco.macro - Error loading Partial View (file: ~/Views/MacroPartials/InsertUmbracoForm.cshtml). Exception: System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'. ---> System.TypeInitializationException: The type initializer for 'Nested' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Destination array is not long enough to copy all the items in the collection. Check array index and length.
at System.Collections.Generic.HashSet1.CopyTo(T[] array, Int32 arrayIndex, Int32 count)
at System.Linq.Buffer1..ctor(IEnumerable1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
at Umbraco.Core.TypeFinder.GetClasses(Type assignTypeFrom, IEnumerable1 assemblies, Boolean onlyConcreteClasses, Func2 additionalFilter)
at Umbraco.Forms.Core.Common.ProviderCollection1.initialize()
at Umbraco.Forms.Core.Common.ProviderCollection1..ctor()
at Umbraco.Forms.Core.Providers.FieldTypeProviderCollection..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstanceT
at Umbraco.Forms.Core.Common.Singleton1.Nested..cctor()
--- End of inner exception stack trace ---
at Umbraco.Forms.Core.Common.Singleton1.getInstance()
at Umbraco.Forms.Core.Providers.FieldTypeProviderCollection.getInstance()
at Umbraco.Forms.Core.Field.getFieldType()
at Umbraco.Forms.Mvc.Models.FormViewModel.Build(Form form)
at Umbraco.Forms.Web.Controllers.UmbracoFormsController.Render(Guid formId, Nullable1 recordId, String view, String mode)
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.PageViewsMacroPartialsInsertUmbracoFormcshtml.Execute() in w:\HostingSpaces\kalfor.dk\kalfor.dk\wwwroot\Views\MacroPartials\InsertUmbracoForm.cshtml:line 17
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer)
at Umbraco.Web.Mvc.ControllerExtensions.RenderViewResultAsString(ControllerBase controller, ViewResultBase viewResult)
at Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, IPublishedContent content)
at umbraco.macro.LoadPartialViewMacro(MacroModel macro)
at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
Error details from frontend:
[ArgumentException: Destination array is not long enough to copy all the items in the collection. Check array index and length.]
System.Collections.Generic.HashSet1.CopyTo(T[] array, Int32 arrayIndex, Int32 count) +5818852
System.Linq.Buffer1..ctor(IEnumerable1 source) +510
System.Linq.Enumerable.ToArray(IEnumerable1 source) +106
Umbraco.Core.TypeFinder.GetClasses(Type assignTypeFrom, IEnumerable1 assemblies, Boolean onlyConcreteClasses, Func2 additionalFilter) +296
Umbraco.Forms.Core.Common.ProviderCollection1.initialize() +131
Umbraco.Forms.Core.Common.ProviderCollection1..ctor() +165
Umbraco.Forms.Core.Providers.FieldTypeProviderCollection..ctor() +43
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +138
System.Activator.CreateInstance() +132
Umbraco.Forms.Core.Common.Nested..cctor() +151
Error on forms, frontend and backoffice: The type initializer for 'Nested' threw an exception
I don't know why as it wasn't the case earlier today.
I have some forms in an Umbraco 7.5.3 solution, among others a contact form.
In backoffice, when I click on let's say the contact form, I get an error:
"Unable to load form: The type initializer for 'Nested' threw an exception."
In frontend the forms throw this:
"Destination array is not long enough to copy all the items in the collection. Check array index and length".
Earlier today I was able to read entries in backoffice of the contact form.
But when I try now, the screen is empty.
From the Umbraco log:
2016-12-27 14:50:25,756 [P26716/D14/T127] WARN umbraco.macro - Error loading Partial View (file: ~/Views/MacroPartials/InsertUmbracoForm.cshtml). Exception: System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'. ---> System.TypeInitializationException: The type initializer for 'Nested' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Destination array is not long enough to copy all the items in the collection. Check array index and length. at System.Collections.Generic.HashSet
1.CopyTo(T[] array, Int32 arrayIndex, Int32 count) at System.Linq.Buffer
1..ctor(IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable
1 source) at Umbraco.Core.TypeFinder.GetClasses(Type assignTypeFrom, IEnumerable1 assemblies, Boolean onlyConcreteClasses, Func
2 additionalFilter) at Umbraco.Forms.Core.Common.ProviderCollection1.initialize() at Umbraco.Forms.Core.Common.ProviderCollection
1..ctor() at Umbraco.Forms.Core.Providers.FieldTypeProviderCollection..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstanceT at Umbraco.Forms.Core.Common.Singleton1.Nested..cctor() --- End of inner exception stack trace --- at Umbraco.Forms.Core.Common.Singleton
1.getInstance() at Umbraco.Forms.Core.Providers.FieldTypeProviderCollection.getInstance() at Umbraco.Forms.Core.Field.getFieldType() at Umbraco.Forms.Mvc.Models.FormViewModel.Build(Form form) at Umbraco.Forms.Web.Controllers.UmbracoFormsController.Render(Guid formId, Nullable1 recordId, String view, String mode) at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult
2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.PageViewsMacroPartialsInsertUmbracoFormcshtml.Execute() in w:\HostingSpaces\kalfor.dk\kalfor.dk\wwwroot\Views\MacroPartials\InsertUmbracoForm.cshtml:line 17 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) at Umbraco.Web.Mvc.ControllerExtensions.RenderViewResultAsString(ControllerBase controller, ViewResultBase viewResult) at Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, IPublishedContent content) at umbraco.macro.LoadPartialViewMacro(MacroModel macro) at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)Error details from frontend:
[ArgumentException: Destination array is not long enough to copy all the items in the collection. Check array index and length.] System.Collections.Generic.HashSet
1.CopyTo(T[] array, Int32 arrayIndex, Int32 count) +5818852 System.Linq.Buffer
1..ctor(IEnumerable1 source) +510 System.Linq.Enumerable.ToArray(IEnumerable
1 source) +106 Umbraco.Core.TypeFinder.GetClasses(Type assignTypeFrom, IEnumerable1 assemblies, Boolean onlyConcreteClasses, Func
2 additionalFilter) +296 Umbraco.Forms.Core.Common.ProviderCollection1.initialize() +131 Umbraco.Forms.Core.Common.ProviderCollection
1..ctor() +165 Umbraco.Forms.Core.Providers.FieldTypeProviderCollection..ctor() +43[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +138 System.Activator.CreateInstance() +132 Umbraco.Forms.Core.Common.Nested..cctor() +151
[TypeInitializationException: The type initializer for 'Nested' threw an exception.] Umbraco.Forms.Core.Common.Singleton
1.get_Instance() +109 Umbraco.Forms.Core.Providers.FieldTypeProviderCollection.get_Instance() +56 Umbraco.Forms.Core.Field.get_FieldType() +213 Umbraco.Forms.Mvc.Models.FormViewModel.Build(Form form) +5132 Umbraco.Forms.Web.Controllers.UmbracoFormsController.Render(Guid formId, Nullable
1 recordId, String view, String mode) +778 lambdamethod(Closure , ControllerBase , Object[] ) +330 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +229 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters) +35 System.Web.Mvc.Async.AsyncControllerActionInvoker._3() +15 System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +27 System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +1737[HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.] System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +2408 System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +131 System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +36 System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +595 System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper htmlHelper, String actionName, String controllerName, Object routeValues) +64 ASP.PageViewsMacroPartialsInsertUmbracoFormcshtml.Execute() in w:\HostingSpaces\kalfor.dk\kalfor.dk\wwwroot\Views\MacroPartials\InsertUmbracoForm.cshtml:17 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +253 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122 Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) +232 Umbraco.Web.Mvc.ControllerExtensions.RenderViewResultAsString(ControllerBase controller, ViewResultBase viewResult) +267 Umbraco.Web.Macros.PartialViewMacroEngine.Execute(MacroModel macro, IPublishedContent content) +842 umbraco.macro.LoadPartialViewMacro(MacroModel macro) +78 umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId) +2992 Umbraco.Web.UmbracoComponentRenderer.RenderMacro(macro m, IDictionary
2 parameters, page umbracoPage) +465 Umbraco.Web.PropertyEditors.ValueConverters.<>c__DisplayClass7.<RenderRteMacros>b__1(String macroAlias, Dictionary
2 macroAttributes) +298 Umbraco.Core.Macros.MacroTagParser.ParseMacros(String text, Action1 textFoundCallback, Action
2 macroFoundCallback) +835 Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter.RenderRteMacros(String source, Boolean preview) +367 Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter.ConvertDataToSource(PublishedPropertyType propertyType, Object source, Boolean preview) +115 Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedProperty.getValue() +73 umbraco.item..ctor(IPublishedContent publishedContent, IDictionary elements, IDictionary attributes) +402 umbraco.presentation.templateControls.ItemRenderer.GetFieldContents(Item item) +378 umbraco.presentation.templateControls.ItemRenderer.ParseMacros(Item item) +114 umbraco.presentation.templateControls.ItemRenderer.Load(Item item) +188 Umbraco.Web.UmbracoComponentRenderer.Field(IPublishedContent currentPage, String fieldAlias, String altFieldAlias, String altText, String insertBefore, String insertAfter, Boolean recursive, Boolean convertLineBreaks, Boolean removeParagraphTags, RenderFieldCaseType casing, RenderFieldEncodingType encoding, Boolean formatAsDate, Boolean formatAsDateWithTime, String formatAsDateWithTimeSeparator) +1664 Umbraco.Web.UmbracoHelper.Field(String fieldAlias, String altFieldAlias, String altText, String insertBefore, String insertAfter, Boolean recursive, Boolean convertLineBreaks, Boolean removeParagraphTags, RenderFieldCaseType casing, RenderFieldEncodingType encoding, Boolean formatAsDate, Boolean formatAsDateWithTime, String formatAsDateWithTimeSeparator) +212 ASP.PageViewsTekstsidecshtml.Execute() in w:\HostingSpaces\kalfor.dk\kalfor.dk\wwwroot\Views\Tekstside.cshtml:50 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +253 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +107 Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) +232 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +375 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +90 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList
1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +833 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +833 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList
1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +833 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +81 System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +186 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38 System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29 System.Web.Mvc.Async.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult) +65 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +36 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38 System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +44 System.Web.Mvc.Async.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult) +65 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137I really hope someone can help me out.
Kind regards, Bruno
Ended up finding this:
http://issues.umbraco.org/issue/CON-1174
This made me try to recycle the app pool for the site, and that helped.
is working on a reply...