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 9:      IEnumerable<protech.Models.File> videos = Model.Videos.Count > 0 ? Model.Videos.Where(p => p.IsVisible).OrderBy(p => p.Priority).Take(5).ToList() : null;
Line 10:     ProductSearch search = new ProductSearch { CategoryId = Model.Category.Id, ExtraWhere = p => p.Id != Model.Id && p.Products.All(pp => pp.Id != Model.Id) };
Line 11:     Dictionary<double, double> quantitySales = new BuyProduct { ProductId = Model.Id }.QuantitySales;
Line 12: 
Line 13:     Content warrantyAndDeliveries = Category.ByKey("WarrantyAndDeliveries").Content.Any(c => c.IsExplanatory) ? Category.ByKey("WarrantyAndDeliveries").Content.Where(c => c.IsExplanatory).FirstOrDefault() : null;

Source File: c:\qualish\protechstore.co.il\wwwroot\Views\Shop\ProductV2.cshtml    Line: 11

Stack Trace:


[FormatException: Input string was not in a correct format.]
   System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) +14672043
   System.String.System.IConvertible.ToDouble(IFormatProvider provider) +57
   System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +713
   Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType) +582

[JsonSerializationException: Error converting value "" to type 'System.Double'. Path '', line 1, position 4.]
   Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType) +728
   Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id) +1036

[JsonSerializationException: Could not convert string '' to dictionary key type 'System.Double'. Create a TypeConverter to convert from the string to the key type object. Path '', line 1, position 4.]
   Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id) +1760
   Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) +1389
   Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) +168
   Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) +748
   Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) +261
   Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) +170
   Newtonsoft.Json.JsonConvert.DeserializeObject(String value, JsonSerializerSettings settings) +53
   protech.Models.BuyProduct.get_QuantitySales() in C:\Projects\פרוטק\protech\protech\Models\Product\BuyProduct.cs:95
   ASP._Page_Views_Shop_ProductV2_cshtml.Execute() in c:\qualish\protechstore.co.il\wwwroot\Views\Shop\ProductV2.cshtml:11
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +86
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +107
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +375
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +88
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +188
   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) +68
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +43
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +68
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128


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