Skip to content
This repository has been archived by the owner on Mar 4, 2023. It is now read-only.

Deserialization Error on empty Int-type fields #3

Closed
KenticoDevTrev opened this issue Jan 9, 2020 · 3 comments
Closed

Deserialization Error on empty Int-type fields #3

KenticoDevTrev opened this issue Jan 9, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@KenticoDevTrev
Copy link

If you have a field that is of type Int (possible others), and you have the value empty, an error occurs when deserializing the data:

`Server Error in '/' Application.
Input string was not in a correct format.
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.FormatException: Input string was not in a correct format.

Source Error:

Line 44: }
Line 45:
Line 46: return TreeNode.New(componentData);
Line 47: }
Line 48:

Source File: H:\Web\KenticoRepositories\kentico-contrib\src\Meeg.Kentico.ContentComponents\Meeg.Kentico.ContentComponents.Cms\PageTypeComponentDeserializer.cs Line: 46

Stack Trace:

[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +14524648
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +172
System.String.System.IConvertible.ToInt32(IFormatProvider provider) +55
System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +550
CMS.DataEngine.SimpleDataClass.SetData(Int32 columnIndex, Object value) +293
CMS.DataEngine.SimpleDataClass.LoadData(IDataContainer data, Boolean loadNullValues) +231
CMS.DocumentEngine.Internal.DocumentFieldsInfo.LoadData(LoadDataSettings settings) +54
CMS.DocumentEngine.TreeNode.LoadCoupledData(String className, IDataContainer data) +190
CMS.DocumentEngine.TreeNode.LoadComponentsData(IDataContainer data) +147
CMS.DocumentEngine.TreeNode.New(String className, DataRow dataRow, TreeProvider treeProvider) +145
Meeg.Kentico.ContentComponents.Cms.PageTypeComponentDeserializer.Deserialize(String componentXml) in H:\Web\KenticoRepositories\kentico-contrib\src\Meeg.Kentico.ContentComponents\Meeg.Kentico.ContentComponents.Cms\PageTypeComponentDeserializer.cs:46
Meeg.Kentico.ContentComponents.Cms.TreeNodeExtensions.GetPageTypeComponent(TreeNode node, String columnName) in H:\Web\KenticoRepositories\kentico-contrib\src\Meeg.Kentico.ContentComponents\Meeg.Kentico.ContentComponents.Cms\TreeNodeExtensions.cs:41
FDLPHA.Controllers.HeroController.RenderBannerHero(TreeNode Page, Boolean ShowDefault) in H:\Web\dev.fdlpha.org\FDLPHA\Controllers\HeroController.cs:36
lambda_method(Closure , ControllerBase , Object[] ) +195
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +35 System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39 System.Web.Mvc.Async.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) +77
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass11_0.b__0() +80
System.Web.Mvc.Async.<>c__DisplayClass11_2.b__2() +387
System.Web.Mvc.Async.<>c__DisplayClass11_2.b__2() +387
System.Web.Mvc.Async.<>c__DisplayClass11_2.b__2() +387
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass3_6.b__4() +50
System.Web.Mvc.Async.<>c__DisplayClass3_1.b__1(IAsyncResult asyncResult) +188
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +26
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +73 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +40
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +73 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38 System.Web.Mvc.<>c__DisplayClass5_0.<Wrap>b__0() +18 System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func1 func) +29
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +1827

[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) +2521
System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +131
System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +29
System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +593
System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper htmlHelper, String actionName, String controllerName, Object routeValues) +64
ASP.<>c__DisplayClass3_0.b__2() in H:\Web\dev.fdlpha.org\FDLPHA\Views\Shared\PageTypes\GenericPage.cshtml:15
System.Web.WebPages.<>c__DisplayClass42_0.b__0(TextWriter tw) +414
System.Web.WebPages.WebPageBase.Write(HelperResult result) +108
ASP._Page_Views_Shared__layout_cshtml.Execute() in H:\Web\dev.fdlpha.org\FDLPHA\Views\Shared_layout.cshtml:49
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
System.Web.WebPages.<>c__DisplayClass40_0.b__0(TextWriter writer) +309
System.Web.WebPages.WebPageBase.Write(HelperResult result) +108
System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action1 body) +89 System.Web.WebPages.WebPageBase.PopContext() +310 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +375 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +88
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +81
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +973
System.Web.Mvc.Controller.ExecuteCore() +128
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +235
DynamicRouting.Kentico.MVC.DynamicHttpHandler.ProcessRequest(HttpContext context) in H:\Web\KenticoRepositories\DynamicRouting\DynamicRouting.Kentico.MVC\DynamicHttpHandler.cs:45
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +866
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +91
`

@CMeeg
Copy link
Owner

CMeeg commented Jan 10, 2020

Hi @KenticoDevTrev, thanks for flagging this. I've reproduced the issue and have a fix ready that I will push soon.

@CMeeg CMeeg self-assigned this Jan 10, 2020
@CMeeg CMeeg added the bug Something isn't working label Jan 10, 2020
@KenticoDevTrev
Copy link
Author

KenticoDevTrev commented Jan 11, 2020 via email

@CMeeg
Copy link
Owner

CMeeg commented Jan 11, 2020

The fix for this issue is available in 0.2.0. If you are experiencing this issue, please re-save any affected pages (and publish if necessary) to cause the component data to be re-serialised, which should fix the issue when deserialising components.

@CMeeg CMeeg closed this as completed in c5e053f Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants